Skip to content

Conversation

@paul-hammant
Copy link
Contributor

Implemented a complete BDD-style testing framework for ChrysaLisp with extensive features, examples, and documentation.

Core Framework (lib/test/test.inc):

  • BDD-style test organization with describe/it blocks
  • Skip functionality (xdescribe/xit)
  • 17 comprehensive assertions (equality, boolean, nil, comparison, collections, error handling)
  • Colored terminal output with symbols (✓/✗/○)
  • Detailed failure reporting
  • Configurable filtering and verbosity
  • Test state management using Fmap

Test Runner (cmd/test-runner.lisp):

  • Automatic test file discovery
  • Pattern-based filtering (-f flag)
  • Verbose mode (-v flag)
  • Color control (-n flag)
  • Custom file patterns (-p flag)
  • List tests mode (-l flag)
  • Exit codes for CI/CD integration (0=pass, 1=fail)

Examples (examples/test/):

  • basic_test.lisp: Fundamental patterns and assertions
  • collections_test.lisp: Sequences and collection operations
  • advanced_test.lisp: Error handling, recursion, edge cases
  • four_horsemen_test.lisp: Deep dive into map/filter/reduce/some
  • smoke_test.lisp: Quick sanity check
  • ~80-90 total tests demonstrating all features

Documentation:

  • docs/test_framework.md: Comprehensive guide with API reference
  • docs/test_framework_quick_reference.md: Quick reference cheat sheet
  • examples/test/README.md: Example file guide and learning path
  • TEST_FRAMEWORK_SUMMARY.md: Implementation summary

Features:

  • Philosophy-aligned with ChrysaLisp (iteration, Four Horsemen, O(1))
  • BDD best practices (readable, organized, focused)
  • Excellent developer experience (fast, clear, flexible)
  • Production-ready with ~1,810 lines of code and documentation

Usage:
./run_tui.sh -n 1 cmd/test-runner.lisp [options] [files...]

Implemented a complete BDD-style testing framework for ChrysaLisp with
extensive features, examples, and documentation.

Core Framework (lib/test/test.inc):
- BDD-style test organization with describe/it blocks
- Skip functionality (xdescribe/xit)
- 17 comprehensive assertions (equality, boolean, nil, comparison,
  collections, error handling)
- Colored terminal output with symbols (✓/✗/○)
- Detailed failure reporting
- Configurable filtering and verbosity
- Test state management using Fmap

Test Runner (cmd/test-runner.lisp):
- Automatic test file discovery
- Pattern-based filtering (-f flag)
- Verbose mode (-v flag)
- Color control (-n flag)
- Custom file patterns (-p flag)
- List tests mode (-l flag)
- Exit codes for CI/CD integration (0=pass, 1=fail)

Examples (examples/test/):
- basic_test.lisp: Fundamental patterns and assertions
- collections_test.lisp: Sequences and collection operations
- advanced_test.lisp: Error handling, recursion, edge cases
- four_horsemen_test.lisp: Deep dive into map/filter/reduce/some
- smoke_test.lisp: Quick sanity check
- ~80-90 total tests demonstrating all features

Documentation:
- docs/test_framework.md: Comprehensive guide with API reference
- docs/test_framework_quick_reference.md: Quick reference cheat sheet
- examples/test/README.md: Example file guide and learning path
- TEST_FRAMEWORK_SUMMARY.md: Implementation summary

Features:
- Philosophy-aligned with ChrysaLisp (iteration, Four Horsemen, O(1))
- BDD best practices (readable, organized, focused)
- Excellent developer experience (fast, clear, flexible)
- Production-ready with ~1,810 lines of code and documentation

Usage:
  ./run_tui.sh -n 1 cmd/test-runner.lisp [options] [files...]
(defq opt-verbose :nil)
(defq opt-no-color :nil)
(defq opt-pattern "examples/test/**/*_test.lisp")
(defq opt-list :nil)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable names style guide problems.

Applied ChrysaLisp naming conventions per docs/ai_digest/coding_style.md:
- Functions/macros: use hyphens (already correct)
- Local variables: use underscores (was using hyphens)
- Globals: use underscores with asterisks (was using hyphens)
- Object properties: use underscores (was using hyphens)

Changes:
- *test-context* → *test_context* (global variable)
- opt-filter → opt_filter (local variables in test-runner.lisp)
- opt-verbose → opt_verbose
- opt-no-color → opt_no_color
- opt-pattern → opt_pattern
- opt-list → opt_list
- test-files → test_files
- All map property keys: 'current-suite → 'current_suite, etc.
- Function parameters: suite-name → suite_name, test-name → test_name
- Test example variables: empty-list → empty_list, max-val → max_val, etc.

All naming now follows ChrysaLisp conventions:
- Hyphens (-) for function/macro names
- Underscores (_) for variables, parameters, properties
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.

3 participants