aboutsummaryrefslogtreecommitdiff
path: root/tests/runerr.sh
diff options
context:
space:
mode:
authorGravatar Moon Flower <moonflower@elhenney.local> 2026-10-12 08:46:23 +0330
committerGravatar Moon Flower <moonflower@elhenney.local> 2026-10-12 08:46:23 +0330
commitecc350ca5c2eb50be8309c5f14f8bf0d87db9a02 (patch)
tree70e0af76a1b13affff7c6cc8aac7b3e6ef960478 /tests/runerr.sh
a
Diffstat (limited to 'tests/runerr.sh')
-rwxr-xr-xtests/runerr.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/runerr.sh b/tests/runerr.sh
new file mode 100755
index 0000000..23ea054
--- /dev/null
+++ b/tests/runerr.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# runs every .zc in a folder (tests/errors by default) and checks the compiler
+# rejects it with the message on its first line: // expect: ...
+vm=${1:-zy}; dir=${2:-$(dirname "$0")/errors}; pass=0; fail=0
+for f in "$dir"/*.zc; do
+ want=$(head -1 "$f" | sed 's#^// expect: ##')
+ got=$($vm < "$f" 2>&1 | head -1)
+ if [[ "$got" == *"$want"* ]]; then pass=$((pass+1)); else fail=$((fail+1)); echo "FAIL $(basename $f): got [$got]"; fi
+done
+echo "rejected: $pass passed, $fail failed"