diff --git a/Makefile b/Makefile index 0ffeb9a..11ba3be 100644 --- a/Makefile +++ b/Makefile @@ -140,6 +140,11 @@ test-errors: ensure-buxc @chmod +x tests/error_golden/run.sh @tests/error_golden/run.sh ./$(OUT) +test-error-recovery: ensure-buxc selfhost + @echo "=== Selfhost multi-error recovery test ===" + @chmod +x _test_error_recovery/run.sh + @_test_error_recovery/run.sh + test-stdlib: ensure-buxc @echo "=== Stdlib golden tests ===" @chmod +x tests/stdlib_golden/run.sh diff --git a/_test_error_recovery/run.sh b/_test_error_recovery/run.sh new file mode 100755 index 0000000..1a12536 --- /dev/null +++ b/_test_error_recovery/run.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Regression: buxc2 must report ALL independent semantic errors in one run. +set -euo pipefail +HERE="$(cd "$(dirname "$0")" && pwd)" +ROOT="$(cd "$HERE/.." && pwd)" +BUXC2="$ROOT/build/selfhost/build/buxc2" +export BUX_STDLIB="$ROOT/lib" + +if [[ ! -x "$BUXC2" ]]; then + echo "=== building selfhost (buxc2) ===" + (cd "$ROOT" && make selfhost) +fi +if [[ ! -x "$BUXC2" ]]; then + echo "error: buxc2 not found at $BUXC2" >&2 + exit 1 +fi + +out="$(cd "$HERE" && "$BUXC2" check src/Main.bux 2>&1 || true)" +echo "$out" + +grep -q "cannot assign String to int" <<<"$out" +grep -q "cannot assign int to bool" <<<"$out" +grep -q "undeclared identifier 'undefined_variable'" <<<"$out" + +echo "PASS: all independent semantic errors reported in one run"