From f7dd08d2791fa4cdb45e494fe604e2017bfcb49b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 24 Mar 2022 17:49:58 -0700 Subject: Run all test cases with and without --nobash option. --- runtests | 3 +- testcases | 91 ++++++++++++++++++++++++++++++----------------------------- testsuite.cwk | 2 +- 3 files changed, 49 insertions(+), 47 deletions(-) diff --git a/runtests b/runtests index 9c0cbc2..e381779 100755 --- a/runtests +++ b/runtests @@ -1,2 +1,3 @@ #!/bin/sh -./testsuite.cwk < testcases +cppawk=./cppawk ./testsuite.cwk < testcases +cppawk="./cppawk --nobash" ./testsuite.cwk < testcases diff --git a/testcases b/testcases index bf22d66..19d0c29 100644 --- a/testcases +++ b/testcases @@ -1,65 +1,65 @@ 1: -./cppawk 'BEGIN { print "hello" }' +$cppawk 'BEGIN { print "hello" }' : hello -- 2: -./cppawk -M 'BEGIN { print 1000000000000000000000000 + 1 }' +$cppawk -M 'BEGIN { print 1000000000000000000000000 + 1 }' : 1000000000000000000000001 -- 3: -./cppawk -f +$cppawk -f : ERR -- 4: -./cppawk -f x -f x +$cppawk -f x -f x : ERR -- 5: -./cppawk -MM 1 +$cppawk -MM 1 : ERR -- 6: -./cppawk -F +$cppawk -F : ERR -- 7: -./cppawk -v +$cppawk -v : ERR -- 8: -./cppawk -E +$cppawk -E : ERR -- 9: -./cppawk -i +$cppawk -i : ERR -- 10: -./cppawk -l +$cppawk -l : ERR -- 11: -./cppawk -L +$cppawk -L : ERR -- 12: -./cppawk +$cppawk : ERR -- 13: -./cppawk ' +$cppawk ' #define min(a,b) ((a) < (b) ? (a) : (b)) { print min($1, $2) }' <= 20220321 }' +$cppawk 'BEGIN { print __cppawk_ver >= 20220321 }' : 1 -- 30: -./cppawk ' +$cppawk ' #include BEGIN { print INT_MIN, INT_MIN, INT_MIN @@ -169,7 +169,7 @@ BEGIN { -2147483648 -2147483648 -2147483648 -- 31: -./cppawk --prepro-only ' +$cppawk --prepro-only ' #if __gawk__ foo_bar #endif' | grep foo_bar @@ -177,48 +177,49 @@ foo_bar foo_bar -- 32: -./cppawk --awk=./testdir/testawk foo ; -./cppawk --nobash --awk=./testdir/testawk foo +case $($cppawk --awk=./testdir/testawk foo) in + '[-f][/d][--]' | '[-f][/t][--]' ) echo yes ;; + * ) exit 1 ;; +esac : -[-f][/d][--] -[-f][/t][--] +yes -- 33: -./cppawk --prepro-only --prepro=./testdir/testcpp abc +$cppawk --prepro-only --prepro=./testdir/testcpp abc : [-iq][-D_][-D_][-I.][-] -- 34: -./cppawk --prepro-only --awk=mawk mawk=__mawk__ | grep mawk +$cppawk --prepro-only --awk=mawk mawk=__mawk__ | grep mawk : mawk=1 -- 35: -./cppawk --prepro-only --awk=mawk gawk=__gawk__ | grep gawk +$cppawk --prepro-only --awk=mawk gawk=__gawk__ | grep gawk : gawk=__gawk__ -- 36: -./cppawk --prepro=die --prepro-only x 2>&1 | (grep -q 'die.*not found' && echo "good") +$cppawk --prepro=die --prepro-only x 2>&1 | (grep -q 'die.*not found' && echo "good") : good -- 37: -tmp=$(./cppawk --awk=testdir/testdel 1); [ -e $tmp ] || echo gone +tmp=$($cppawk --awk=testdir/testdel 1); [ -e $tmp ] || echo gone : gone -- 38: -./cppawk --prepro-only -f testdir/program.cwk | grep BEGIN +$cppawk --prepro-only -f testdir/program.cwk | grep BEGIN : BEGIN { print ((42) > (73) ? (42) : (73)) } -- 39: -./cppawk --prepro-only 'foo +$cppawk --prepro-only 'foo bar -baz' | ./cppawk '/foo/,/baz/' +baz' | $cppawk '/foo/,/baz/' : foo @@ -227,7 +228,7 @@ bar baz -- 40: -./cppawk '#!hashbang +$cppawk '#!hashbang BEGIN { print __LINE__ print __LINE__ }' @@ -236,6 +237,6 @@ BEGIN { print __LINE__ 4 -- 41: -./cppawk -f testdir/name.cwk +$cppawk -f testdir/name.cwk : testdir/name.cwk diff --git a/testsuite.cwk b/testsuite.cwk index fd8fa7d..c70788c 100755 --- a/testsuite.cwk +++ b/testsuite.cwk @@ -21,7 +21,7 @@ function runtest(id, code, output, } if (failed) - printf("test %s failed\n", id) + printf("test %s failed (for cppawk = %s)\n", id, ENVIRON["cppawk"]) close("script.sh") close("output") -- cgit v1.2.3