Repository navigation
refactor: colocate production unit tests with _test.rs filenames - #498
Conversation
WalkthroughWarning Review details and warnings were omitted to fit the comment limit. |
There was a problem hiding this comment.
🔵 Needs a closer look
Although static checks confirm the #[path] rename is internally consistent, the change spans ~768 files across the entire production test surface and full runtime/test-identity preservation can only be confirmed by a green CI build under human review.
0 open findings
What changed in this PR
This PR is a large, purely mechanical refactor that standardizes the location and naming of production unit tests across the workspace. Previously, test code lived inconsistently as inline #[cfg(test)] mod blocks, tests/mod.rs aggregators, and ad-hoc _tests.rs / bare .rs filenames. The PR colocates every test-bearing file under a sibling tests/ directory and enforces a uniform <name>_test.rs suffix, wiring each up with an explicit #[cfg(test)] #[path = ".../tests/<name>_test.rs"] mod ...; declaration. This improves discoverability and makes the "every test file ends in _test.rs" invariant auditable, while deliberately preserving module names, test identities, private access (use super::*), and fixture paths.
Changes:
- Rename/relocate ~768 existing test files to a
tests/<name>_test.rslayout and update their#[path]references accordingly. - Extract 32 inline
#[cfg(test)] modblocks into standalone_test.rsfiles. - Scope the change to production crate source trees, excluding dedicated test/support and integration crates.
| File (grouped by area) | Description |
|---|---|
neovm-core/src/tagged/** (mod.rs, value.rs, mutate.rs, symbol_marks.rs, gc/*) |
Repoint #[path] to tests/*_test.rs; add new gc/tests/chunk_entry_decode_test.rs; wire extracted submodules. |
neovm-core/src/emacs_core/text/** (charset, coding, composite, chartable, json, format, search, regex/dfa, syntax, string_*, emacs_char, treesit, xml, textprop) |
Replace tests/mod.rs and bare test paths with *_test.rs; register nested test submodules. |
neovm-core/src/{window,keyboard,face,encoding,image_identity,lib}.rs + window/frame_alpha.rs |
Update mod tests declarations to tests/*_test.rs; add nested #[path] submodule registrations. |
New extracted *_test.rs files (e.g. buffer/tests/overlay_bplus_traversal_storage_test.rs, native_presentation/tests/abi_test.rs, presentation/tests/pacing_test.rs) |
Hold test code moved out of former inline modules; rely on use super::*. |
| Remaining crates (renderer-wgpu, display-runtime, display-protocol, layout-engine, etc.) | Same mechanical #[path] + _test.rs renames applied consistently. |
My verification: all 1,529 real #[path] module targets resolve to existing files (the 3 apparent misses are a doc comment, a fixture string, and benchmark input data — not compiled). Inline extractions removed their original bodies and the new files resolve use super::* against the unchanged declaring module. Duplicate #[path] targets are all legitimate shared helpers/fixtures (e.g. opt_sink_numeric_fixture.rs contains no #[test] fns), not accidental double-registration. No objective bug, naming, or structural issue was found, so no inline comments were filed.
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Production unit tests had inconsistent locations and filenames, including inline modules and
_tests.rsfiles. Move test cases into each relatedtests/directory and require_test.rsfor every test-bearing file.Validation:
main(753dfe9ad2), preserving the transition effect inventory and JIT feature-gating changes.