forge
Explore
Log in

Don't you dare go Hollow

Count the split guard's clear with matches, not split

Browse files at this commit

ceffb92d73e85446b28147554bcf896cb6c73669Ahmet Kaan GümüşParent: dd3fe34
  • test
    • count the split guard's clear with matches, not split
Show full message
🐛 test(timeline): count the split guard's clear with matches, not split

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.rsmodified+5 -2
@@ -2731,14 +2731,17 @@ fn a_refused_split_keeps_the_clip_in_hand() {
2731 .split_once("} else {")2731 .split_once("} else {")
2732 .expect("the split door no longer branches on what the cut answered")2732 .expect("the split door no longer branches on what the cut answered")
2733 .0;2733 .0;
2734- let cleared_twice = after.split("self.selected.clear()").count() > 1;2734+ // One arm's worth of clear, counted with `matches`: `split(..).count()`
2735+ // counts the pieces *between* matches, so a single occurrence reads as two
2736+ // there and the guard fails on the fix it is guarding.
2737+ let extra_clear = after.matches("self.selected.clear()").count() > 1;
2735 assert!(2738 assert!(
2736 !before.contains("self.selected.clear()"),2739 !before.contains("self.selected.clear()"),
2737 "the split drops the selection before it knows the cut happened, so a \2740 "the split drops the selection before it knows the cut happened, so a \
2738 refused split leaves the user with nothing picked and nothing told"2741 refused split leaves the user with nothing picked and nothing told"
2739 );2742 );
2740 assert!(2743 assert!(
2741- then.contains("self.selected.clear()") && !cleared_twice,2744+ then.contains("self.selected.clear()") && !extra_clear,
2742 "the clear does not ride the split's own success branch: a split that \2745 "the clear does not ride the split's own success branch: a split that \
2743 happened leaves the mark naming a different clip across the seam, and a \2746 happened leaves the mark naming a different clip across the seam, and a \
2744 refused one must leave it naming the clip it named"2747 refused one must leave it naming the clip it named"