Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 2.13 KB

File metadata and controls

43 lines (32 loc) · 2.13 KB

TDD Workflow

NotPlusPlus follows a strict red-green-refactor loop for all feature work.

Required loop

  1. Start from the smallest failing test that expresses the next behavior.
  2. Put the test in the lowest layer that owns the behavior.
  3. Run only that test while implementing the minimum change.
  4. Refactor after the test is green.
  5. Run cargo test --all-targets before considering the change complete.

Test placement

  • Lexer behavior goes in lexer unit or integration tests.
  • Grammar and AST behavior goes in parser tests.
  • Name resolution, type rules, and unsupported-feature rejection go in semantic tests.
  • Execution, built-in output, and runtime failures go in runtime or end-to-end tests.
  • CLI behavior and exit codes go in binary integration tests.

Repository layout

  • src/: implementation and small unit tests for pure helpers.
  • tests/: integration tests and golden coverage.
  • tests/fixtures/: source programs grouped by lexer, parser, sema, runtime, integration, and cli.

Commands

  • Focused loop: cargo test <test_name>
  • Full verification: cargo test --all-targets
  • Snapshot review: cargo insta test and cargo insta review
  • Format code: cargo fmt
  • Check formatting: cargo fmt --check

Milestone policy

  • Milestone 1 starts with lexer tests for tokens, comments, and spans.
  • Milestone 2 starts with parser tests for function forms, statements, precedence, and syntax diagnostics.
  • Milestone 3 starts with semantic tests for scopes, type rules, main, and unsupported constructs.
  • Milestone 4 starts with runtime tests for arithmetic, control flow, calls, output, and exit behavior.
  • Milestone 5 starts with runtime and integration tests for recursion limits, runtime stack traces, and their exit behavior.
  • Milestone 6 starts with parser, semantic, and runtime tests for array declarations, indexing, bounds checks, and initialization tracking.
  • Milestone 7 starts with dump-renderer tests in tests/lexer.rs and tests/parser.rs, diagnostic relationship tests in tests/diagnostics.rs and tests/sema.rs, runtime trace tests in tests/runtime.rs, and binary CLI snapshots in tests/cli.rs.