From 31818613417e727aaa61fabcc408af7e5c0a2ba8 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Thu, 23 Jul 2026 14:00:49 +0000 Subject: [PATCH] Assert the Link MMP pane exists before asserting its colour mmp_focused_pane_indicator checked that the unfocused Link MMP title is not cyan with assert_ne! over fg_at. fg_at is find(..)? mapped to the cell's foreground, so it returns None for a title that was never drawn, and None != Some(Cyan). The assertion therefore passed just as happily when the pane was missing entirely as when it was present and unstyled. Assert presence first, so the colour check means "not highlighted" rather than "not there". Demonstrated rather than argued. Renaming the pane title in mmp.rs so "Link MMP" is never rendered leaves the original assertion passing, and makes the new one fail with the message it was given. Both files restored after. This is the only instance of the shape: it is the sole assert_ne! over fg_at or find in the fipstop tree, and the only assert_ne! in snapshots.rs at all. Quartet clean: fmt, build, clippy --all-targets -D warnings, test --lib at 1376 passed / 0 failed / 7 ignored. --- src/bin/fipstop/ui/snapshots.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bin/fipstop/ui/snapshots.rs b/src/bin/fipstop/ui/snapshots.rs index 2bfe1c0..f9f4fe8 100644 --- a/src/bin/fipstop/ui/snapshots.rs +++ b/src/bin/fipstop/ui/snapshots.rs @@ -1189,6 +1189,15 @@ fn mmp_focused_pane_indicator() { }); // The focused Session MMP title is cyan; the unfocused Link MMP title is not. assert_eq!(testkit::fg_at(&buf, "Session MMP"), Some(Color::Cyan)); + // Presence before colour. `fg_at` is `find(..)?` mapped to the cell's fg, so + // it returns None for a title that was never drawn, and None != Some(Cyan) -- + // meaning the assertion below passed when the Link MMP pane was missing + // entirely. Asserting it is on screen first is what makes the next line read + // "not highlighted" rather than "not there". + assert!( + testkit::find(&buf, "Link MMP").is_some(), + "the unfocused Link MMP title should still be rendered" + ); assert_ne!(testkit::fg_at(&buf, "Link MMP"), Some(Color::Cyan)); }