test: keep the READMEs' agent count honest

Both READMEs say tty7 detects 18 CLI agents. `CLIAgent::ALL` holds 18,
so today they are right — Claude, Codex, Gemini, Aider, Amp, OpenCode,
Copilot, Cursor, Goose, Droid, Pi, Auggie, Hermes, Vibe, Antigravity,
Grok, Qwen, OhMyPi.

Nothing held them together. A nineteenth agent is a one-line addition to
that array, and the number lives in prose in two files nobody edits in
the same change — the front page would go on claiming eighteen and no
gate would notice, which is exactly how the reboot claim in the last
commit got to stay wrong.

So the test reads the other file, the way `keymap` reads its own source
for the action list and `aumid` reads windows-installer.iss. Checked
that it is not vacuous: neither README contains "19 CLI", so the day the
array grows the assertion fires.
This commit is contained in:
l0ng-ai
2026-08-16 10:16:00 +08:00
parent 418ebbf960
commit 789aa897dc
+24
View File
@@ -628,6 +628,30 @@ pub fn parse_agent_event(payload: &[u8]) -> Option<AgentEvent> {
mod tests {
use super::*;
/// The READMEs count the agents tty7 detects, and the count is in prose.
///
/// Both say "18 CLIs"; `CLIAgent::ALL` is what makes that true, and a
/// nineteenth agent would leave two sentences quietly wrong in the file
/// most people read first. Checked the way `keymap` checks its action
/// list and `aumid` checks the installer script: read the other file.
#[test]
fn the_readmes_count_the_agents_this_enum_holds() {
let n = CLIAgent::ALL.len();
for (name, text) in [
("README.md", include_str!("../../../../README.md")),
(
"README.zh-CN.md",
include_str!("../../../../README.zh-CN.md"),
),
] {
assert!(
text.contains(&format!("{n} CLI")) || text.contains(&format!("{n} 个 CLI")),
"{name} does not say there are {n} CLI agents; \
CLIAgent::ALL has {n} and the file has to agree"
);
}
}
fn argv(parts: &[&str]) -> Vec<String> {
parts.iter().map(|s| s.to_string()).collect()
}