From 645eb759cba3db32350239b812f7d8e159f752ee Mon Sep 17 00:00:00 2001 From: Nylme Date: Tue, 19 Nov 2024 22:32:20 +1100 Subject: [PATCH] parsing_typeable_commands: added test for macro command labels --- helix-term/src/config.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/helix-term/src/config.rs b/helix-term/src/config.rs index abc678448..4c2340e91 100644 --- a/helix-term/src/config.rs +++ b/helix-term/src/config.rs @@ -226,6 +226,7 @@ mod tests { c = ":buffer-close" h = ["vsplit", "normal_mode", "swap_view_left"] j = {command = ["hsplit", "normal_mode", "swap_view_down"], label = "split down"} + n = { label = "Delete word", command = "@wd" } "#; let config = Config::load_test(sample_keymaps); @@ -277,6 +278,20 @@ mod tests { ] ); } + + let macro_keys = node.get(&KeyEvent::from_str("n").unwrap()).unwrap(); + if let keymap::KeyTrie::MappableCommand(MappableCommand::Macro { name, keys }) = + macro_keys + { + assert_eq!(name, "Delete word"); + assert_eq!( + keys, + &vec![ + KeyEvent::from_str("w").unwrap(), + KeyEvent::from_str("d").unwrap() + ] + ); + } } else { panic!("Config did not parse to trie"); }