aboutsummaryrefslogtreecommitdiff
path: root/docs/history/17-o3-boundaries/code/tests/runerr.sh
blob: 23ea0543e11358ba3be8893e807479ee22544dd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
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"