Add test for autoclosing w/ matching start and end char

This commit is contained in:
Max Brunsfeld 2022-10-25 12:22:19 -07:00
parent cb9534eae0
commit e9073310c4

View File

@ -3039,6 +3039,12 @@ async fn test_autoclose_pairs(cx: &mut gpui::TestAppContext) {
close: false,
newline: true,
},
BracketPair {
start: "\"".to_string(),
end: "\"".to_string(),
close: true,
newline: false,
},
],
autoclose_before: "})]".to_string(),
..Default::default()
@ -3159,6 +3165,13 @@ async fn test_autoclose_pairs(cx: &mut gpui::TestAppContext) {
cx.set_state("«aˇ» b");
cx.update_editor(|view, cx| view.handle_input("{", cx));
cx.assert_editor_state("{«aˇ»} b");
// Autclose pair where the start and end characters are the same
cx.set_state("");
cx.update_editor(|view, cx| view.handle_input("\"", cx));
cx.assert_editor_state("a\"ˇ\"");
cx.update_editor(|view, cx| view.handle_input("\"", cx));
cx.assert_editor_state("a\"\"ˇ");
}
#[gpui::test]