Cut the split guard at the then-branch it means
Browse files at this commit4f7f26dbfabf3c6d632de44a619768296f80a7fcParent: 16925fd- test
- cut the split guard at the then-branch it means
1 changed file +14 -3
crates/app/src/tests/editing.rsmodified+14 -3
| @@ -2722,15 +2722,26 @@ fn a_refused_split_keeps_the_clip_in_hand() { | |||
| 2722 | let (before, after) = body | 2722 | let (before, after) = body |
| 2723 | .split_once("if cut {") | 2723 | .split_once("if cut {") |
| 2724 | .expect("the split door no longer gates anything on its own answer"); | 2724 | .expect("the split door no longer gates anything on its own answer"); |
| 2725 | + // The door's own branch, cut apart at its `else`: "runs after `if cut {`" is | ||
| 2726 | + // satisfied by the shape this fix replaced as well, because the clear sat | ||
| 2727 | + // below the whole if/else and so inside everything that followed the gate -- | ||
| 2728 | + // a revert of the fix would have shipped green. What the arm has to be is | ||
| 2729 | + // inside the then-branch, and nothing that follows the branch may hold one. | ||
| 2730 | + let then = after | ||
| 2731 | + .split_once("} else {") | ||
| 2732 | + .expect("the split door no longer branches on what the cut answered") | ||
| 2733 | + .0; | ||
| 2734 | + let cleared_twice = after.split("self.selected.clear()").count() > 1; | ||
| 2725 | assert!( | 2735 | assert!( |
| 2726 | !before.contains("self.selected.clear()"), | 2736 | !before.contains("self.selected.clear()"), |
| 2727 | "the split drops the selection before it knows the cut happened, so a \ | 2737 | "the split drops the selection before it knows the cut happened, so a \ |
| 2728 | refused split leaves the user with nothing picked and nothing told" | 2738 | refused split leaves the user with nothing picked and nothing told" |
| 2729 | ); | 2739 | ); |
| 2730 | assert!( | 2740 | assert!( |
| 2731 | - after.contains("self.selected.clear()"), | 2741 | + then.contains("self.selected.clear()") && !cleared_twice, |
| 2732 | - "a split that happened no longer drops the selection, so the mark names \ | 2742 | + "the clear does not ride the split's own success branch: a split that \ |
| 2733 | - a different clip on the far side of the seam" | 2743 | + happened leaves the mark naming a different clip across the seam, and a \ |
| 2744 | + refused one must leave it naming the clip it named" | ||
| 2734 | ); | 2745 | ); |
| 2735 | } | 2746 | } |
| 2736 | 2747 | ||