diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-03-24 17:49:58 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-03-24 17:49:58 -0700 |
commit | f7dd08d2791fa4cdb45e494fe604e2017bfcb49b (patch) | |
tree | f5c1c882a279378ac1835332ee87160c0efd54ed | |
parent | 96d19551c0ceaf98ad065930ee82b8ff7961d826 (diff) | |
download | cppawk-f7dd08d2791fa4cdb45e494fe604e2017bfcb49b.tar.gz cppawk-f7dd08d2791fa4cdb45e494fe604e2017bfcb49b.tar.bz2 cppawk-f7dd08d2791fa4cdb45e494fe604e2017bfcb49b.zip |
Run all test cases with and without --nobash option.
-rwxr-xr-x | runtests | 3 | ||||
-rw-r--r-- | testcases | 91 | ||||
-rwxr-xr-x | testsuite.cwk | 2 |
3 files changed, 49 insertions, 47 deletions
@@ -1,2 +1,3 @@ #!/bin/sh -./testsuite.cwk < testcases +cppawk=./cppawk ./testsuite.cwk < testcases +cppawk="./cppawk --nobash" ./testsuite.cwk < 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) }' <<! 1 2 @@ -71,21 +71,21 @@ ERR 2 -- 14: -./cppawk -Itestdir ' +$cppawk -Itestdir ' #include "header.cwh" BEGIN { print max(42, 73) }' : 73 -- 15: -./cppawk -iquotetestdir ' +$cppawk -iquotetestdir ' #include "header.cwh" BEGIN { print max(42, 73) }' : 73 -- 16: -./cppawk ' +$cppawk ' BEGIN { #if __gawk__ print "gawk" @@ -95,72 +95,72 @@ BEGIN { gawk -- 17: -./cppawk -M 'BEGIN { print __bignum__ }' +$cppawk -M 'BEGIN { print __bignum__ }' : 1 -- 18: -./cppawk 'BEGIN { print __bignum__ }' +$cppawk 'BEGIN { print __bignum__ }' : -- 19: -./cppawk -P 'BEGIN { print __posix__ }' +$cppawk -P 'BEGIN { print __posix__ }' : 1 -- 20: -./cppawk 'BEGIN { print __posix__ }' +$cppawk 'BEGIN { print __posix__ }' : -- 21: -./cppawk --prepro-only 'BEGIN { }' | grep BEGIN +$cppawk --prepro-only 'BEGIN { }' | grep BEGIN : BEGIN { } -- 22: -./cppawk -v foo="'\"" 'BEGIN { print foo }' +$cppawk -v foo="'\"" 'BEGIN { print foo }' : '" -- 23: -./cppawk -f testdir/program.cwk +$cppawk -f testdir/program.cwk : 73 -- 24: -./cppawk -v foo="abc def" 'BEGIN { print foo }' +$cppawk -v foo="abc def" 'BEGIN { print foo }' : abc def -- 25: -./cppawk 'BEGIN { printf("%s:%s:%s\n", ARGC, ARGV[1], ARGV[2]) }' "ab c" "'" +$cppawk 'BEGIN { printf("%s:%s:%s\n", ARGC, ARGV[1], ARGV[2]) }' "ab c" "'" : 3:ab c:' -- 26: -./cppawk -v foo="abc\\ndef" 'BEGIN { print foo }' +$cppawk -v foo="abc\\ndef" 'BEGIN { print foo }' : abc def -- 27: -./cppawk -v foo='abc\n"def' 'BEGIN { print foo }' +$cppawk -v foo='abc\n"def' 'BEGIN { print foo }' : abc "def -- 28: -./cppawk -v foo="abc'def" 'BEGIN { print foo }' +$cppawk -v foo="abc'def" 'BEGIN { print foo }' : abc'def -- 29: -./cppawk 'BEGIN { print __cppawk_ver >= 20220321 }' +$cppawk 'BEGIN { print __cppawk_ver >= 20220321 }' : 1 -- 30: -./cppawk ' +$cppawk ' #include <limits.h> 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") |