aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorGokul Soumya2021-11-10 15:58:35 +0000
committerGitHub2021-11-10 15:58:35 +0000
commite863e3b62d232d650468cb5d1f9da925fb460f5e (patch)
tree0c2e57c38a25d2726cb8f0ff9f5d3d5adf7f6427 /helix-term/src
parentf9e9efb3ecc4aa22c270c043f7442791e810940c (diff)
Ensure that identical keymaps stay in sync (#1056)
Space mode and view mode are duplicated on two different keybinds, and they tend to get out of sync by contributers forgetting to update both of them. This commit adds a test that explicitly checks that they are identical. Prevents issues like #1050.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/keymap.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index 53e0d450..4fb0f172 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -802,4 +802,20 @@ mod tests {
let node = keymap.root().search(&[crate::key!(' ')]).unwrap();
assert!(!node.node().unwrap().order().is_empty())
}
+
+ #[test]
+ fn aliased_modes_are_same_in_default_keymap() {
+ let keymaps = Keymaps::default();
+ let root = keymaps.get(&Mode::Normal).unwrap().root();
+ assert_eq!(
+ root.search(&[key!(' '), key!('w')]).unwrap(),
+ root.search(&["C-w".parse::<KeyEvent>().unwrap()]).unwrap(),
+ "Mismatch for window mode on `Space-w` and `Ctrl-w`"
+ );
+ assert_eq!(
+ root.search(&[key!('z')]).unwrap(),
+ root.search(&[key!('Z')]).unwrap(),
+ "Mismatch for view mode on `z` and `Z`"
+ );
+ }
}