From f3049089000eb8f5ff68191da9abc9cac63914ca Mon Sep 17 00:00:00 2001 From: Andy C Date: Wed, 16 Feb 2022 15:26:27 -0500 Subject: [PATCH] [refactor] Use test-func style in more tests csv2html, oil_lang, and tea --- oil_lang/run.sh | 17 ++++++----------- tea/run.sh | 13 ++++--------- test/other.sh | 2 +- web/table/csv2html-test.sh | 18 ++++++------------ 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/oil_lang/run.sh b/oil_lang/run.sh index 7e4c3b99fe..8a39624c9a 100755 --- a/oil_lang/run.sh +++ b/oil_lang/run.sh @@ -19,14 +19,12 @@ parse-one() { if test $? -ne 0; then return 255; fi # make xargs quit } -parse-all-osh() { +test-parse-osh() { find oil_lang/testdata -name '*.sh' -o -name '*.osh' \ | xargs -n 1 -- $0 parse-one } -all-passing() { - ### Run all the examples - +test-run-osh() { for prog in oil_lang/testdata/*.{sh,osh}; do echo $prog @@ -45,7 +43,9 @@ all-passing() { echo --- bin/osh $prog done +} +test-run-oil() { for prog in oil_lang/testdata/*.oil; do echo --- bin/oil $prog all @@ -73,19 +73,14 @@ demo() { bin/osh oil_lang/testdata/assign.osh } -all() { - parse-all-osh - all-passing -} - soil-run() { ### Used by soil/worker.sh. Prints to stdout. - all + run-test-funcs } run-for-release() { ### Used by devtools/release.sh. Writes a file. - run-other-suite-for-release oil-large all + run-other-suite-for-release oil-large run-test-funcs } "$@" diff --git a/tea/run.sh b/tea/run.sh index 4b4f1414db..2a193dff29 100755 --- a/tea/run.sh +++ b/tea/run.sh @@ -27,12 +27,12 @@ parse-one() { if test $? -ne 0; then return 255; fi # make xargs quit } -parse-all-tea() { +test-parse-all-tea() { # Parse with the Oil binary tea-files | xargs --verbose -n 1 -- $0 parse-one } -usage-test() { +test-usage() { local prog='data Point(x Int, y Int)' bin/oil -O parse_tea -n -c "echo 'hi'; $prog" @@ -43,19 +43,14 @@ usage-test() { echo "$prog" | bin/tea -n } -all() { - parse-all-tea - usage-test -} - soil-run() { ### Used by soil/worker.sh. Prints to stdout. - all + run-test-funcs } run-for-release() { ### Used by devtools/release.sh. Writes a file. - run-other-suite-for-release tea-large all + run-other-suite-for-release tea-large run-test-funcs } "$@" diff --git a/test/other.sh b/test/other.sh index de582e3260..646c6d9d27 100755 --- a/test/other.sh +++ b/test/other.sh @@ -22,7 +22,7 @@ xargs-test() { csv2html-test() { pushd web/table - ./csv2html-test.sh + ./csv2html-test.sh all popd } diff --git a/web/table/csv2html-test.sh b/web/table/csv2html-test.sh index ec0dfbbc5c..20335bfa94 100755 --- a/web/table/csv2html-test.sh +++ b/web/table/csv2html-test.sh @@ -9,6 +9,7 @@ set -o errexit readonly REPO_ROOT=$(readlink -f $(dirname $0))/../.. +source $REPO_ROOT/test/common.sh source $REPO_ROOT/web/table/html.sh @@ -147,18 +148,11 @@ EOF } -if test $# -eq 0; then +all() { link-static + echo + run-test-funcs +} - test-no-schema - echo '--' - test-schema - echo '--' - test-precision - echo '--' - test-row-css-class -else - "$@" -fi - +"$@"