forge
Explore
Log in

Don't you dare go Hollow

Bound each history arm before asserting it arms

Browse files at this commit

87eae130aab2ded6a6a36f15f34d07c4fd5558fbAhmet Kaan GümüşParent: 4f7f26d
  • test
    • bound each history arm before asserting it arms
Show full message
🐛 test(autosave): bound each history arm before asserting it arms

The history check read everything after each gate, so Redo's `mark_dirty()` satisfied Undo's -- deleting Undo's own arm kept the test green (verifier finding H2). Each arm is now cut at the arm that follows it: `ActionId::Redo =>` for Undo, `ActionId::AddVideoLane =>` for Redo.
crates/app/src/tests/cards.rsmodified+10 -3
@@ -1663,13 +1663,20 @@ fn every_click_door_that_writes_the_project_arms_autosave() {
1663 // the door's own answer ("there was a step to take") is the gate, so `^z`1663 // the door's own answer ("there was a step to take") is the gate, so `^z`
1664 // with an empty history leaves the flag -- and the close question -- clear.1664 // with an empty history leaves the flag -- and the close question -- clear.
1665 let act = fn_body("act");1665 let act = fn_body("act");
1666- for gate in ["if self.undo(cx) {", "if self.redo(cx) {"] {1666+ for (gate, next) in [
1667- let after = act1667+ ("if self.undo(cx) {", "ActionId::Redo =>"),
1668+ ("if self.redo(cx) {", "ActionId::AddVideoLane =>"),
1669+ ] {
1670+ let arm = act
1668 .split_once(gate)1671 .split_once(gate)
1669 .unwrap_or_else(|| panic!("{gate} is gone from the action table"))1672 .unwrap_or_else(|| panic!("{gate} is gone from the action table"))
1670 .1;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 assert!(1678 assert!(
1672- after.contains("mark_dirty()"),1679+ arm.contains("mark_dirty()"),
1673 "the arm behind `{gate}` arms nothing, so a real step back is \1680 "the arm behind `{gate}` arms nothing, so a real step back is \
1674 invisible to autosave, the unsaved ghost and the close question"1681 invisible to autosave, the unsaved ghost and the close question"
1675 );1682 );