NotPlusPlus follows a strict red-green-refactor loop for all feature work.
- Start from the smallest failing test that expresses the next behavior.
- Put the test in the lowest layer that owns the behavior.
- Run only that test while implementing the minimum change.
- Refactor after the test is green.
- Run
cargo test --all-targetsbefore considering the change complete.
- 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.
src/: implementation and small unit tests for pure helpers.tests/: integration tests and golden coverage.tests/fixtures/: source programs grouped bylexer,parser,sema,runtime,integration, andcli.
- Focused loop:
cargo test <test_name> - Full verification:
cargo test --all-targets - Snapshot review:
cargo insta testandcargo insta review - Format code:
cargo fmt - Check formatting:
cargo fmt --check
- 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.rsandtests/parser.rs, diagnostic relationship tests intests/diagnostics.rsandtests/sema.rs, runtime trace tests intests/runtime.rs, and binary CLI snapshots intests/cli.rs.