diff --git a/src/command/cmd.rs b/src/command/cmd.rs index 18cec24..f59eb68 100644 --- a/src/command/cmd.rs +++ b/src/command/cmd.rs @@ -2067,25 +2067,27 @@ mod tests { #[test] fn quit_when_dirty_shows_warning() { let m = two_cat_model(); + let mut bufs = HashMap::new(); + bufs.insert("command".to_string(), "q".to_string()); let mut ctx = make_ctx(&m); ctx.dirty = true; - let cmd = QuitCmd; + ctx.buffers = &bufs; + let cmd = ExecuteCommand; let effects = cmd.execute(&ctx); - // Should produce a status message, not a mode change to Quit - assert_eq!(effects.len(), 1); - // Verify it's a SetStatus by checking debug output - let dbg = format!("{:?}", effects[0]); + let dbg = format!("{:?}", effects); assert!(dbg.contains("SetStatus"), "Expected SetStatus, got: {dbg}"); } #[test] fn quit_when_clean_produces_quit_mode() { let m = two_cat_model(); - let ctx = make_ctx(&m); - let cmd = QuitCmd; + let mut bufs = HashMap::new(); + bufs.insert("command".to_string(), "q".to_string()); + let mut ctx = make_ctx(&m); + ctx.buffers = &bufs; + let cmd = ExecuteCommand; let effects = cmd.execute(&ctx); - assert_eq!(effects.len(), 1); - let dbg = format!("{:?}", effects[0]); + let dbg = format!("{:?}", effects); assert!( dbg.contains("ChangeMode"), "Expected ChangeMode, got: {dbg}"