Skip to content

refactor: colocate production unit tests with _test.rs filenames - #498

Merged
eval-exec merged 1 commit into
mainfrom
refactor/unit-test-directories
Oct 7, 2026
Merged

eval-exec merged 1 commit into
mainfrom
refactor/unit-test-directories

Conversation

@eval-exec

Copy link
Copy Markdown
Owner

Production unit tests had inconsistent locations and filenames, including inline modules and _tests.rs files. Move test cases into each related tests/ directory and require _test.rs for every test-bearing file.

  • Rename or relocate 768 existing files and extract 32 inline test modules.
  • Preserve module names, test identities, private access, relative fixtures, and macro module paths.
  • Limit changes to production crate source trees; exclude dedicated test/support crates and integration suites.

Validation:

  • Rebased onto latest main (753dfe9ad2), preserving the transition effect inventory and JIT feature-gating changes.
  • Strict production audit: 1,191 test-bearing files, zero location or suffix violations.
  • Production workspace test compilation and neovm-core test compilation without default features pass.
  • Formatting and diff checks pass.
  • Before rebase, all 16 production library test binaries compiled; all 12,863 neovm-core test names were preserved.
  • Earlier broader test execution recorded 4,372 passes, 53 failures, and one abort. Failures include missing generated Lisp fixtures, unavailable font downloads, sandbox socket restrictions, missing video features, and unresolved startup assertions. The missing-fixture startup failure was reproduced in an unmodified baseline binary; the full suite is not claimed green.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 17:19
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Walkthrough

Warning

Review details and warnings were omitted to fit the comment limit.

@eval-exec
eval-exec merged commit 4b227d0 into main Oct 7, 2026
31 of 43 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 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.rs layout and update their #[path] references accordingly.
  • Extract 32 inline #[cfg(test)] mod blocks into standalone _test.rs files.
  • 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.

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.

2 participants