diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-03-18 07:42:59 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-03-18 07:42:59 -0700 |
commit | 90bd48c414b9e6d53eeca76b9fea92cafc3883d6 (patch) | |
tree | 2df5d2b6857e0732affac4eb06092a6d3adce022 | |
parent | 4dd985c97390ece2596738206850a06cdeeb6b09 (diff) | |
download | cppawk-90bd48c414b9e6d53eeca76b9fea92cafc3883d6.tar.gz cppawk-90bd48c414b9e6d53eeca76b9fea92cafc3883d6.tar.bz2 cppawk-90bd48c414b9e6d53eeca76b9fea92cafc3883d6.zip |
Check that -f without argument fails.
-rw-r--r-- | testcases | 5 | ||||
-rwxr-xr-x | testsuite.cwk | 15 |
2 files changed, 17 insertions, 3 deletions
@@ -7,3 +7,8 @@ hello ./cppawk -M 'BEGIN { print 1000000000000000000000000 + 1 }' : 1000000000000000000000001 +-- +3: +./cppawk -f +: +ERR diff --git a/testsuite.cwk b/testsuite.cwk index ce495d0..fd8fa7d 100755 --- a/testsuite.cwk +++ b/testsuite.cwk @@ -5,15 +5,24 @@ BEGIN { FS = ":\n" } -function runtest(id, code, output) +function runtest(id, code, output, + failed) { print code > "script.sh" print output > "output" - if (system("[ \"$(sh script.sh)\" = \"$(cat output)\" ]") != 0) { - printf("test %s failed\n", id) + failed = 0 + + if (output == "ERR\n") { + if (system("sh script.sh > /dev/null 2>&1") == 0) + failed = 1 + } else if (system("[ \"$(sh script.sh)\" = \"$(cat output)\" ]") != 0) { + failed = 1 } + if (failed) + printf("test %s failed\n", id) + close("script.sh") close("output") } |