@@ -0,0 +1,39 @@
1+#!/bin/bash
2+cd "$(dirname "$0")/.."
3+
4+# Build the library first
5+bunx spago build > /dev/null 2>&1
6+
7+PASS=0
8+FAIL=0
9+TOTAL=0
10+
11+for f in compile-fail-tests/*.purs; do
12+ EXPECT=$(head -1 "$f" | sed 's/-- EXPECT: //')
13+ NAME=$(basename "$f" .purs)
14+ TOTAL=$((TOTAL + 1))
15+
16+ # Rewrite module name and copy into src/ temporarily
17+ sed "s/^module .*/module Yoga.Postgres.CompileFailTest where/" "$f" > "src/_CompileFailTest.purs"
18+ OUTPUT=$(bunx spago build 2>&1) || true
19+ rm -f "src/_CompileFailTest.purs"
20+
21+ if echo "$OUTPUT" | grep -q "Build succeeded"; then
22+ echo "FAIL $NAME — compiled successfully (should have failed)"
23+ FAIL=$((FAIL + 1))
24+ elif echo "$OUTPUT" | grep -q "$EXPECT"; then
25+ echo "PASS $NAME — failed with expected: $EXPECT"
26+ PASS=$((PASS + 1))
27+ else
28+ echo "FAIL $NAME — failed but without expected '$EXPECT'"
29+ echo " Got: $(echo "$OUTPUT" | grep "ERROR" | head -3)"
30+ FAIL=$((FAIL + 1))
31+ fi
32+done
33+
34+echo ""
35+echo "$PASS passed, $FAIL failed out of $TOTAL compile-fail tests"
36+
37+if [ "$FAIL" -ne 0 ]; then
38+ exit 1
39+fi