diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-03-18 07:28:56 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-03-18 07:28:56 -0700 |
commit | d2efeadbaa963c2a38a0670f3a555acb906689a3 (patch) | |
tree | ed3aa7f0575498afba9ba8ace91f7d1ded49b28e | |
parent | f315ee7e35eee5cba24ed71c646ecdfd37a4ba27 (diff) | |
download | cppawk-d2efeadbaa963c2a38a0670f3a555acb906689a3.tar.gz cppawk-d2efeadbaa963c2a38a0670f3a555acb906689a3.tar.bz2 cppawk-d2efeadbaa963c2a38a0670f3a555acb906689a3.zip |
Start test case implementation.
-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) +} |