Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

[codex] document out-of-line test module convention (#25682)

Adam Perry @ OpenAIa29a5b08615d
diff --git a/AGENTS.md b/AGENTS.md
index 9ee9b2b6d8..1c164a23b2 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.