#!/bin/bash # runs every tests/errors/*.zc and checks the compiler rejects it with the expected message vm=${1:-zy}; pass=0; fail=0 for f in "$(dirname "$0")"/errors/*.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 "analyzer rejects: $pass passed, $fail failed"