From e9073310c4b981641ed7dcc12a854e5d45e9527b Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 25 Oct 2022 12:22:19 -0700 Subject: [PATCH] Add test for autoclosing w/ matching start and end char --- crates/editor/src/editor_tests.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index 58978c51f0d388bdcf9a2f0f8700777a34f34311..206b5c67aa34dd382a5fe005d4fdf8c029453311 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -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("aˇ"); + 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]