aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite.cwk
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-03-18 07:28:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-03-18 07:28:56 -0700
commitd2efeadbaa963c2a38a0670f3a555acb906689a3 (patch)
treeed3aa7f0575498afba9ba8ace91f7d1ded49b28e /testsuite.cwk
parentf315ee7e35eee5cba24ed71c646ecdfd37a4ba27 (diff)
downloadcppawk-d2efeadbaa963c2a38a0670f3a555acb906689a3.tar.gz
cppawk-d2efeadbaa963c2a38a0670f3a555acb906689a3.tar.bz2
cppawk-d2efeadbaa963c2a38a0670f3a555acb906689a3.zip
Start test case implementation.
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)
+}