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