From 87eae130aab2ded6a6a36f15f34d07c4fd5558fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 24 Sep 2026 14:34:58 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20test(autosave):=20bound=20each?= =?UTF-8?q?=20history=20arm=20before=20asserting=20it=20arms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index 4c9e247..cae3767 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -1663,13 +1663,20 @@ fn every_click_door_that_writes_the_project_arms_autosave() { // the door's own answer ("there was a step to take") is the gate, so `^z` // with an empty history leaves the flag -- and the close question -- clear. let act = fn_body("act"); - for gate in ["if self.undo(cx) {", "if self.redo(cx) {"] { - let after = act + for (gate, next) in [ + ("if self.undo(cx) {", "ActionId::Redo =>"), + ("if self.redo(cx) {", "ActionId::AddVideoLane =>"), + ] { + let arm = act .split_once(gate) .unwrap_or_else(|| panic!("{gate} is gone from the action table")) .1; + // Cut at the arm *after* this one: "everything from here on" is + // satisfied by the sibling's arm, so deleting Undo's own would ship + // green. + let arm = arm.split_once(next).map_or(arm, |(arm, _)| arm); assert!( - after.contains("mark_dirty()"), + arm.contains("mark_dirty()"), "the arm behind `{gate}` arms nothing, so a real step back is \ invisible to autosave, the unsaved ghost and the close question" );