Added tests for alt->meta behavior

This commit is contained in:
Mikayla Maki 2022-09-13 09:39:29 -07:00
parent 9c42b92663
commit b45d5e83bb

View file

@ -405,6 +405,40 @@ mod test {
}
}
#[test]
fn alt_is_meta() {
let ascii_printable = ' '..='~';
for character in ascii_printable {
assert_eq!(
to_esc_str(
&Keystroke::parse(&format!("alt-{}", character)).unwrap(),
&TermMode::NONE,
true
)
.unwrap(),
format!("\x1b{}", character)
);
}
let gpui_keys = [
"up", "down", "right", "left", "f1", "f2", "f3", "f4", "F5", "f6", "f7", "f8", "f9",
"f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "insert",
"pageup", "pagedown", "end", "home",
];
for key in gpui_keys {
assert_ne!(
to_esc_str(
&Keystroke::parse(&format!("alt-{}", key)).unwrap(),
&TermMode::NONE,
true
)
.unwrap(),
format!("\x1b{}", key)
);
}
}
#[test]
fn test_modifier_code_calc() {
// Code Modifiers