diff --git a/crates/export/src/clip.rs b/crates/export/src/clip.rs index 65a25c17a1..a782f27a18 100644 --- a/crates/export/src/clip.rs +++ b/crates/export/src/clip.rs @@ -335,7 +335,9 @@ mod tests { // One style: the text cap stops it. let mut b = ClipBuilder::new(); let chunk = "y".repeat(1 << 16); - while b.push(&chunk, &a) {} + // Bounded, so the test fails rather than runs on when the cap is gone. + let pushes = (0..MAX_CLIP_TEXT_BYTES / chunk.len() + 2).take_while(|_| b.push(&chunk, &a)).count(); + assert!(pushes <= MAX_CLIP_TEXT_BYTES / chunk.len(), "the cap stopped it: {pushes}"); let clip = b.finish(); assert!(clip.truncated); assert!(clip.paragraphs.iter().flatten().map(|s| s.text.len()).sum::() <= MAX_CLIP_TEXT_BYTES);