diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/exitstatus.sh | 8 |
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 |
