4echo "Testing custom error messages..."
7WORKSPACE_ROOT="/Users/mark/Developer/purescript-yoga-om"
8PACKAGE_DIR="$WORKSPACE_ROOT/packages/yoga-om-layer"
9TEST_DIR="$PACKAGE_DIR/test-negative"
10SRC_DIR="$PACKAGE_DIR/src"
12if [ ! -d "$TEST_DIR" ]; then
13 echo "❌ Test directory not found: $TEST_DIR"
20# First, ensure the main package compiles (without negative tests)
21echo "Building main package..."
23if ! bunx spago build -p yoga-om-layer > /dev/null 2>&1; then
24 echo "❌ Main package failed to build"
27echo "✓ Main package builds successfully"
30# Now test each negative test individually
31for test_file in "$TEST_DIR"/*.purs; do
32 if [ ! -f "$test_file" ]; then
36 base_name=$(basename "$test_file" .purs)
37 expected_file="$TEST_DIR/$base_name.expected"
39 if [ ! -f "$expected_file" ]; then
40 echo "⚠️ No .expected file for $base_name, skipping"
44 expected_content=$(cat "$expected_file")
46 echo -n "Testing $base_name... "
48 # Compile this specific test file with the already-built package
49 # First ensure output exists
50 if [ ! -d "$WORKSPACE_ROOT/output" ]; then
51 echo "❌ Output directory not found, run 'npx spago build' first"
55 error_output=$(cd "$WORKSPACE_ROOT" && \
58 "$SRC_DIR/**/*.purs" \
59 "packages/yoga-om-core/src/**/*.purs" \
63 # Special case: should compile successfully
64 if [ "$expected_content" = "SHOULD_COMPILE" ]; then
65 if echo "$error_output" | grep -q "Error"; then
66 echo "❌ (should compile but doesn't)"
67 echo "$error_output" | head -20
70 echo "✅ (compiles as expected)"
76 # Check if expected error appears in output
77 if echo "$error_output" | grep -q "$expected_content"; then
82 echo "Expected to find:"
83 echo "$expected_content"
86 echo "$error_output" | grep -A 10 "Error" | head -20
93echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
94echo "Results: $passed passed, $failed failed"
95echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
97if [ $failed -gt 0 ]; then
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list