diff --git a/AGENTS.md b/AGENTS.md index 9ee9b2b6d82e..1c164a23b281 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -110,6 +110,19 @@ See `codex-rs/tui/styles.md`. ## Tests +### Test module organization + +- When adding a new test module, define its contents in a separate sibling file rather than inline in the implementation file. +- Use an explicit `#[path = "..._tests.rs"]` attribute so the test filename is descriptive and easy to locate: + + ```rust + #[cfg(test)] + #[path = "parser_tests.rs"] + mod tests; + ``` + +- This applies only when introducing a new test module. Do not move or rewrite existing inline `#[cfg(test)] mod tests { ... }` modules solely to follow this convention. + ### Snapshot tests This repo uses snapshot tests (via `insta`), especially in `codex-rs/tui`, to validate rendered output.