parsing_typeable_commands: added test for macro command labels

pull/3958/head
Nylme 2024-11-19 22:32:20 +11:00 committed by Matthew Cheely
parent c1ff1f6572
commit 645eb759cb
1 changed files with 15 additions and 0 deletions

View File

@ -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");
}