From f2e18d030c156bca1db54ec493dd42845b262cc9 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 16 Aug 2026 10:19:34 +0800 Subject: [PATCH] test: keep the settings page counting the sections it has MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `docs/customization/settings.mdx` says "The eight sections" and then shows one card each. `SettingsSection::ALL` has eight, and the names line up — Appearance, Terminal, Input, SSH, Agents, Window & Tabs, Keybindings, About. Adding a ninth means editing an array in `settings.rs` and a page in `docs/` that nothing links to it. The count is stated twice there, in words and in cards, so a section added without touching the page leaves two wrong statements on the page that explains the window. Both are now read by the test, the same move as the READMEs' agent count in the last commit. Not vacuous: the page has no "The nine sections" and exactly eight cards, so a ninth section fails on both assertions. --- src/ui/settings.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/ui/settings.rs b/src/ui/settings.rs index e9dbb0a8..748bfe3c 100644 --- a/src/ui/settings.rs +++ b/src/ui/settings.rs @@ -7188,6 +7188,36 @@ impl Tty7App { mod tests { use super::*; + /// The settings page documentation counts the sections, twice. + /// + /// A heading in words and one card per section, in a file that is not + /// opened when a section is added to `SettingsSection::ALL`. Same guard as + /// the READMEs' agent count: read the other file, so a ninth section is a + /// failing test rather than a page that quietly says eight. + #[test] + fn the_settings_page_documents_every_section() { + const DOC: &str = include_str!("../../docs/customization/settings.mdx"); + let n = SettingsSection::ALL.len(); + + let word = [ + "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", + "eleven", "twelve", + ] + .get(n) + .copied() + .unwrap_or("many"); + assert!( + DOC.contains(&format!("The {word} sections")), + "the page does not say it has {word} ({n}) sections" + ); + + let cards = DOC.matches("