aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testcases5
-rwxr-xr-xtestsuite.cwk15
2 files changed, 17 insertions, 3 deletions
diff --git a/testcases b/testcases
index ba4ed64..8797315 100644
--- a/testcases
+++ b/testcases
@@ -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")
}