fix(tui/tests): scrub intro art in spacer snapshots

This commit is contained in:
James Peter
2025-12-10 03:21:18 +10:00
parent 291a7ce861
commit 8f540cd2f1
5 changed files with 29 additions and 40 deletions
@@ -207,6 +207,7 @@ fn normalize_output(text: String) -> String {
.collect::<String>()
.pipe(normalize_timers)
.pipe(normalize_spacer_rows)
.pipe(scrub_intro_art)
}
fn normalize_glyph(ch: char) -> char {
@@ -233,6 +234,26 @@ fn normalize_glyph(ch: char) -> char {
}
}
fn scrub_intro_art(text: String) -> String {
let mut lines: Vec<String> = text.lines().map(|line| line.to_string()).collect();
if let Some(star_idx) = lines
.iter()
.position(|line| line.contains("/code - perform a coding task"))
{
for line in lines.iter_mut().take(star_idx) {
if !line.trim().is_empty() {
*line = String::new();
}
}
}
for line in lines.iter_mut() {
*line = line.trim_end().to_string();
}
lines.join("\n")
}
fn normalize_timers(text: String) -> String {
static IN_SECONDS_RE: OnceLock<Regex> = OnceLock::new();
static T_MINUS_RE: OnceLock<Regex> = OnceLock::new();
@@ -2,22 +2,6 @@
source: tui/tests/bottom_spacer_clip_regression.rs
expression: collapsed
---
| Code |
E
█
█
█
★ /code - perform a coding task (multiple agents)
@@ -38,5 +22,5 @@ expression: collapsed
• preserves the last visible line.
| What can I code for you today? |
Read Only (Shift+Tab change) Ctrl+G guide • API key
@@ -2,22 +2,6 @@
source: tui/tests/bottom_spacer_clip_regression.rs
expression: expanded
---
| Code |
E
█
█
█
★ /code - perform a coding task (multiple agents)
@@ -38,5 +22,5 @@ expression: expanded
• preserves the last visible line.
| What can I code for you today? |
Read Only (Shift+Tab change) Ctrl+G guide • API key
@@ -3,9 +3,9 @@ source: tui/tests/bottom_spacer_clip_regression.rs
expression: output
---
| Code |
with scroll offsets.
Assistant reply #6 contains a deliberately verbose paragraph that discusses wrapping,
• stream padding, viewport math, and the importance of not clipping the final line.
@@ -28,5 +28,5 @@ expression: output
last row of history.
| What can I code for you today? |
Read Only (Shift+Tab change) Ctrl+G guide • API key
@@ -3,9 +3,9 @@ source: tui/tests/bottom_spacer_clip_regression.rs
expression: output
---
| Code |
- Running commands
› Could you provide a detailed overview of how the anti-clipping spacer
@@ -22,5 +22,5 @@ expression: output
final row historically vanished.
| What can I code for you today? |
Read Only (Shift+Tab change) Ctrl+G guide • API key