From ceffb92d73e85446b28147554bcf896cb6c73669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 24 Sep 2026 14:43:21 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20test(timeline):=20count=20the=20?= =?UTF-8?q?split=20guard's=20clear=20with=20matches,=20not=20split?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The guard added a moment ago counted `after.split("self.selected.clear()").count() > 1`, and `split` counts the pieces *between* matches -- one clear reads as two pieces, so the guard failed on the very fix it guards. `matches` is what counts the clear itself. Its own trap, caught by running it: the four-filter run is green on live code and each revert mutation now fails exactly the guard it belongs to. --- crates/app/src/tests/editing.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/app/src/tests/editing.rs b/crates/app/src/tests/editing.rs index 1bda185..7a78f46 100644 --- a/crates/app/src/tests/editing.rs +++ b/crates/app/src/tests/editing.rs @@ -2731,14 +2731,17 @@ fn a_refused_split_keeps_the_clip_in_hand() { .split_once("} else {") .expect("the split door no longer branches on what the cut answered") .0; - let cleared_twice = after.split("self.selected.clear()").count() > 1; + // One arm's worth of clear, counted with `matches`: `split(..).count()` + // counts the pieces *between* matches, so a single occurrence reads as two + // there and the guard fails on the fix it is guarding. + let extra_clear = after.matches("self.selected.clear()").count() > 1; assert!( !before.contains("self.selected.clear()"), "the split drops the selection before it knows the cut happened, so a \ refused split leaves the user with nothing picked and nothing told" ); assert!( - then.contains("self.selected.clear()") && !cleared_twice, + then.contains("self.selected.clear()") && !extra_clear, "the clear does not ride the split's own success branch: a split that \ happened leaves the mark naming a different clip across the seam, and a \ refused one must leave it naming the clip it named"