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() {
27312731 .split_once("} else {")
27322732 .expect("the split door no longer branches on what the cut answered")
27332733 .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;
27352738 assert!(
27362739 !before.contains("self.selected.clear()"),
27372740 "the split drops the selection before it knows the cut happened, so a \
27382741 refused split leaves the user with nothing picked and nothing told"
27392742 );
27402743 assert!(
2741- then.contains("self.selected.clear()") && !cleared_twice,
2744+ then.contains("self.selected.clear()") && !extra_clear,
27422745 "the clear does not ride the split's own success branch: a split that \
27432746 happened leaves the mark naming a different clip across the seam, and a \
27442747 refused one must leave it naming the clip it named"