use super::super::spell::{bindings, spellings};
use super::super::{KeyAction, ZoomStep};
const TABLE: &[&str] = &[
"↑",
"↓",
"←",
"→",
"Enter",
"Escape",
"(1)",
"(2)",
"(3)",
"(4)",
"(5)",
"(6)",
"(a)",
"(b)",
"(c)",
"(f)",
"(g)",
"(i)",
"(m)",
"(n)",
"(r)",
"(s)",
"(w)",
"(x)",
"Ctrl+↑",
"Ctrl+↓",
"Ctrl+←",
"Ctrl+→",
"Ctrl++",
"Ctrl+-",
"Ctrl+0",
"Ctrl+1",
"Ctrl+2",
"Ctrl+3",
"Ctrl+4",
"Ctrl+5",
"Ctrl+6",
"Ctrl+B",
"Ctrl+F",
"Ctrl+G",
"Ctrl+I",
"Ctrl+J",
"Ctrl+N",
"Ctrl+Shift++",
"Ctrl+Shift+1",
"Ctrl+Shift+2",
"Ctrl+Shift+3",
"Ctrl+Shift+4",
"Ctrl+Shift+N",
];
#[test]
fn the_vocabulary_is_the_doc_table() {
assert_eq!(spellings(), TABLE);
}
#[test]
fn a_spelling_names_the_intent_the_table_binds() {
let bound = bindings();
for (press, action) in [
("(f)", KeyAction::Scan),
("Ctrl+F", KeyAction::Search),
("↓", KeyAction::ListNext),
("Ctrl+↓", KeyAction::ListNext),
("→", KeyAction::ExpandRow),
("Ctrl+←", KeyAction::CollapseRow),
("(x)", KeyAction::Stop),
("Ctrl+Shift+N", KeyAction::NewWorkspace),
("Ctrl+0", KeyAction::Zoom(ZoomStep::Reset)),
("Escape", KeyAction::Cancel),
] {
assert!(
bound.contains(&(press.to_owned(), action)),
"{press} does not spell {action:?}"
);
}
}