aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 21:15:13 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 21:15:13 +0330
commit3405cb8a34b8706ee2de3f110aeced3b7de2a890 (patch)
tree45fca828bd71ae55df4e60aa7d89b0cf09f4f291 /tests
parentdetach doc comments on internal bounds helpers (genome size); todo: reuse cap... (diff)
zy: a runtime trap exits 2 (rt.trap: index out of range, frame overflow, out of heap, bad pointer, use after free); compile errors stay 1; spec 8.1.3; exitstatus.sh checks exit 2
Diffstat (limited to 'tests')
-rw-r--r--tests/exitstatus.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/exitstatus.sh b/tests/exitstatus.sh
index d48ad1f..064aa1a 100644
--- a/tests/exitstatus.sh
+++ b/tests/exitstatus.sh
@@ -1,8 +1,9 @@
#!/bin/bash
# exit status of zy: a program that fails to compile (syntax, type or analyzer
# error, or too many errors) exits 1; a good program exits 0; a runtime trap
-# keeps its status (0 today). usage: tests/exitstatus.sh [VM]. prints one line
-# per case and exits 1 when any case is wrong.
+# (bounds, overflow, out of memory, bad pointer) exits 2. usage:
+# tests/exitstatus.sh [VM]. prints one line per case and exits 1 when any
+# case is wrong.
vm=${1:-build/bin/zy}
T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
fail=0
@@ -17,5 +18,6 @@ want 1 "an undefined name" <<< $'namespace;\ninclude rt;\nfn main() { rt.put_n(n
want 1 "a type error" < tests/typeerrors/arg.zc
want 1 "an analyzer error" < tests/errors/alias_field.zc
want 1 "twenty errors" < <(printf 'namespace;\ninclude rt;\nfn main() {\n'; for i in $(seq 25); do echo " int a$i = ;"; done; echo ' return 0; }')
-want 0 "a runtime trap keeps its status" < tests/programs/bounds_heap.zc
+want 2 "a bounds trap" < tests/programs/bounds_heap.zc
+want 0 "an explicit halt" <<< $'namespace;\ninclude rt;\nfn main() { rt.put_n(1); rt.halt(); return 3; }'
exit $fail