diff options
-rw-r--r-- | testcases | 5 | ||||
-rwxr-xr-x | testsuite.cwk | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/testcases b/testcases new file mode 100644 index 0000000..b52e737 --- /dev/null +++ b/testcases @@ -0,0 +1,5 @@ +1: +./cppawk 'BEGIN { print "hello" }' +: +hello +-- diff --git a/testsuite.cwk b/testsuite.cwk new file mode 100755 index 0000000..ce495d0 --- /dev/null +++ b/testsuite.cwk @@ -0,0 +1,23 @@ +#!./cppawk -f + +BEGIN { + RS = "--\n" + FS = ":\n" +} + +function runtest(id, code, output) +{ + print code > "script.sh" + print output > "output" + + if (system("[ \"$(sh script.sh)\" = \"$(cat output)\" ]") != 0) { + printf("test %s failed\n", id) + } + + close("script.sh") + close("output") +} + +$1 { + runtest($1, $2, $3) +} |