aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite.cwk
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite.cwk')
-rwxr-xr-xtestsuite.cwk15
1 files changed, 12 insertions, 3 deletions
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")
}