Skip to content

Conversation

@jjtolton
Copy link

Summary

Adds error detection to catch when test files fail to load due to syntax errors. The framework now detects empty test lists and reports a clear error message instead of silently passing.

  • Detects when no tests are found in any module
  • Reports error in red text with helpful message
  • Returns exit code 1 on file loading errors
  • Maintains backward compatibility with valid test files

Fixes #5

Test Plan

All scenarios pass with correct exit codes:

  • ✓ Syntax error files: show red error + exit 1
  • ✓ Passing tests: show green success + exit 0
  • ✓ Mixed pass/fail: show results + exit 1
  • ✓ Multiple error types: all detected properly

Run ./example/run_error_detection_tests.sh to see all test scenarios.

Implementation Details

  • Modified run_tests_opt/4 to check test discovery results
  • Added collect_all_tests/2 helper predicate
  • Uses existing ANSI color formatting for error message
  • Updated documentation with error detection behavior
  • Added comprehensive test files demonstrating the feature

jjtolton and others added 2 commits October 16, 2025 15:34
When test files fail to load due to syntax errors, the testing framework now
detects that no tests were found and reports a clear error message in red text.
This makes it obvious that something went wrong with file loading, rather than
silently skipping to successful execution.

- Detect when no tests are found in any module
- Report error in red text: "ERROR: No tests found. This may indicate a file loading error."
- Return exit code 1 on file loading errors (matching test failure behavior)
- Add test files demonstrating syntax error detection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Demonstrates all test scenarios in one convenient script
- Shows syntax error detection with red error message
- Shows passing tests scenario
- Shows mixed pass/fail scenario
- Shows alternate syntax error type
- Validates exit codes are correct for each scenario
- All tests passing with ✓ indicators

Usage: ./example/run_error_detection_tests.sh

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add error detection for file loading failures in test framework

1 participant