Skip to content

refactor: move unit tests into <module>_tests.rs files - #210

Merged
tupe12334 merged 2 commits into
mainfrom
refactor/extract-unit-tests
Sep 24, 2026
Merged

tupe12334 merged 2 commits into
mainfrom
refactor/extract-unit-tests

Conversation

@tupe12334

@tupe12334 tupe12334 commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #209 (review request: "extract the tests to <x>_tests.rs files"). Originally stacked on #209; now rebased onto main after #209 merged.

  • Every inline #[cfg(test)] mod tests { ... } in core/src/ now lives in a sibling <module>_tests.rs, declared as #[cfg(test)] #[path = "<module>_tests.rs"] mod tests;. Test names, use super::* access to private items, and the #[allow(...)] attributes are unchanged.
  • The proptest_tests modules in cel_eval and flow go to <module>_proptest_tests.rs. proptest-regressions/cel_eval.txt is renamed to cel_eval_proptest_tests.txt, because proptest locates regression files by source path.
  • src/bin/main.rs tests go to src/bin/main_tests.rs. I added autobins = false so Cargo doesn't try to build that file as a second binary. The explicit [[bin]] steplock target is unchanged.
  • CONTRIBUTING.md documents the layout.
  • Lint ratchet: clippy::items_after_statements is now deny (no existing violations).

No test logic changed. The only edits are moving code and letting rustfmt re-indent it.

Test plan

  • cargo test passes with the same counts as before the move (112 lib, 25 bin, 16 cli, 11 integration)
  • cargo clippy --all-targets -- -D warnings passes
  • cargo fmt -- --check passes
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps passes
  • cargo package --list includes all 12 *_tests.rs files

🤖 Generated with Claude Code

Each module's inline `mod tests { ... }` now lives in a sibling
`<module>_tests.rs` (property tests in `<module>_proptest_tests.rs`),
declared with `#[path]` so test names and privacy are unchanged.

- `autobins = false` so src/bin/main_tests.rs is not built as a binary.
- Rename the cel_eval proptest regression file to match its new source.
- Document the layout in CONTRIBUTING.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@tupe12334
tupe12334 force-pushed the refactor/extract-unit-tests branch from e5e5b81 to a6b979c Compare September 24, 2026 08:15
@tupe12334
tupe12334 changed the base branch from feat/global-checklists to main September 24, 2026 08:15
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@tupe12334
tupe12334 force-pushed the refactor/extract-unit-tests branch from a6b979c to 18c40e4 Compare September 24, 2026 08:19
@tupe12334
tupe12334 merged commit cd23f96 into main Sep 24, 2026
13 checks passed
@tupe12334
tupe12334 deleted the refactor/extract-unit-tests branch September 24, 2026 08:44
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.

1 participant