From 2062535c20459a097a098d664a8f75e17c9cfcff Mon Sep 17 00:00:00 2001 From: Nils Andreas Svee Date: Sat, 15 Aug 2026 01:49:23 +0700 Subject: [PATCH] test(tui): assert the warning on its sample-panel row The whole-frame substring assertions passed as long as the warning appeared anywhere, so a sample panel regressing to "last warning: -" would still have been reported as covered. The assertion now locates the last-warning row and requires it to carry the warning itself. --- crates/irtt-cli/src/cmd/tui/ui.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/crates/irtt-cli/src/cmd/tui/ui.rs b/crates/irtt-cli/src/cmd/tui/ui.rs index 878eb6d..0b90ed8 100644 --- a/crates/irtt-cli/src/cmd/tui/ui.rs +++ b/crates/irtt-cli/src/cmd/tui/ui.rs @@ -3078,7 +3078,8 @@ mod tests { fn active_sample_data_and_warnings_are_visible_in_the_large_layout() { let state = active_dashboard_state(); - let text = render_text(&state, 140, 40); + let rows = render_rows(&state, 140, 40); + let text = rows.join("\n"); // Session identity from the header. assert!(text.contains("0xabcd")); @@ -3086,10 +3087,20 @@ mod tests { // The most recent sample and its effective RTT. assert!(text.contains("last seq: 11")); assert!(text.contains("2.5ms")); - // Warning presentation reaches the recent-events panel and the sample - // panel's last-warning row. - assert!(text.contains("wrong token")); - assert!(text.contains("last warning:")); + // The warning reaches the recent-events panel... + assert!(rows + .iter() + .any(|row| row.contains("warning") && row.contains("wrong token"))); + // ...and the sample panel's last-warning row carries the warning + // itself, not the absent-value placeholder. + let last_warning = rows + .iter() + .find(|row| row.contains("last warning:")) + .expect("the large layout renders a last-warning row"); + assert!( + last_warning.contains("wrong token"), + "last-warning row did not carry the warning: {last_warning}" + ); } #[test]