Bound each history arm before asserting it arms
Browse files at this commit87eae130aab2ded6a6a36f15f34d07c4fd5558fbParent: 4f7f26d- test
- bound each history arm before asserting it arms
1 changed file +10 -3
crates/app/src/tests/cards.rsmodified+10 -3
| @@ -1663,13 +1663,20 @@ fn every_click_door_that_writes_the_project_arms_autosave() { | ||
| 1663 | 1663 | // the door's own answer ("there was a step to take") is the gate, so `^z` |
| 1664 | 1664 | // with an empty history leaves the flag -- and the close question -- clear. |
| 1665 | 1665 | let act = fn_body("act"); |
| 1666 | - for gate in ["if self.undo(cx) {", "if self.redo(cx) {"] { | |
| 1667 | - let after = act | |
| 1666 | + for (gate, next) in [ | |
| 1667 | + ("if self.undo(cx) {", "ActionId::Redo =>"), | |
| 1668 | + ("if self.redo(cx) {", "ActionId::AddVideoLane =>"), | |
| 1669 | + ] { | |
| 1670 | + let arm = act | |
| 1668 | 1671 | .split_once(gate) |
| 1669 | 1672 | .unwrap_or_else(|| panic!("{gate} is gone from the action table")) |
| 1670 | 1673 | .1; |
| 1674 | + // Cut at the arm *after* this one: "everything from here on" is | |
| 1675 | + // satisfied by the sibling's arm, so deleting Undo's own would ship | |
| 1676 | + // green. | |
| 1677 | + let arm = arm.split_once(next).map_or(arm, |(arm, _)| arm); | |
| 1671 | 1678 | assert!( |
| 1672 | - after.contains("mark_dirty()"), | |
| 1679 | + arm.contains("mark_dirty()"), | |
| 1673 | 1680 | "the arm behind `{gate}` arms nothing, so a real step back is \ |
| 1674 | 1681 | invisible to autosave, the unsaved ghost and the close question" |
| 1675 | 1682 | ); |