From 0265f066b39dee7c25f141ef26dcb2f44143933f Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 29 Oct 2026 11:40:21 +0700 Subject: [PATCH] #1409: split a long batch test for the cognitive complexity lint --- crates/engine/src/batch_step_ref_tests.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/engine/src/batch_step_ref_tests.rs b/crates/engine/src/batch_step_ref_tests.rs index f5ce3a83..17d9fc72 100644 --- a/crates/engine/src/batch_step_ref_tests.rs +++ b/crates/engine/src/batch_step_ref_tests.rs @@ -371,6 +371,11 @@ fn a_continue_batch_keeps_successful_steps_as_one_undo_entry() { let error = results[1]["error"].as_str().unwrap(); assert!(error.contains("step 1:") && error.contains("is not text"), "{error}"); assert!(results[1].get("result").is_none()); + undo_and_redo_the_continued_batch(&mut s, frame, text, &name, undo); +} + +/// The successful steps of the batch above undo and redo as one step. +fn undo_and_redo_the_continued_batch(s: &mut Session, frame: figcraft_doc::NodeId, text: figcraft_doc::NodeId, name: &str, undo: usize) { assert!(matches!(&s.doc().unwrap().node(text).unwrap().kind, figcraft_doc::NodeKind::Text(t) if t.characters == "novo")); assert_eq!(s.doc().unwrap().node(s.page().unwrap()).unwrap().name, "Depois do erro"); assert_eq!(s.undo_depth(), (undo + 1, 0));