Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
helix: Add more tests (#33582)
fantacelld10cc139241e
diff --git a/crates/vim/src/helix.rs b/crates/vim/src/helix.rsindex d0bbf5f17f3..42890d7a060 100644--- a/crates/vim/src/helix.rs+++ b/crates/vim/src/helix.rs@@ -302,14 +302,14 @@ mod test {use crate::{state::Mode, test::VimTestContext};#[gpui::test]- async fn test_next_word_start(cx: &mut gpui::TestAppContext) {+ async fn test_word_motions(cx: &mut gpui::TestAppContext) {let mut cx = VimTestContext::new(cx, true).await;// «// ˇ// »cx.set_state(indoc! {"- The quˇick brown+ Th«e quiˇ»ck brownfox jumps overthe lazy dog."},Mode::HelixNormal,@@ -334,6 +334,32 @@ mod test {the lazy dog."},Mode::HelixNormal,);++ cx.simulate_keystrokes("2 b");++ cx.assert_state(+ indoc! {"+ The «ˇquick »brown+ fox jumps over+ the lazy dog."},+ Mode::HelixNormal,+ );++ cx.simulate_keystrokes("down e up");++ cx.assert_state(+ indoc! {"+ The quicˇk brown+ fox jumps over+ the lazy dog."},+ Mode::HelixNormal,+ );++ cx.set_state("aa\n «ˇbb»", Mode::HelixNormal);++ cx.simulate_keystroke("b");++ cx.assert_state("aa\n«ˇ »bb", Mode::HelixNormal);}// #[gpui::test]@@ -448,4 +474,21 @@ mod test {Mode::HelixNormal,);}++ #[gpui::test]+ async fn test_newline_char(cx: &mut gpui::TestAppContext) {+ let mut cx = VimTestContext::new(cx, true).await;++ cx.set_state("aa«\nˇ»bb cc", Mode::HelixNormal);++ cx.simulate_keystroke("w");++ cx.assert_state("aa\n«bb ˇ»cc", Mode::HelixNormal);++ cx.set_state("aa«\nˇ»", Mode::HelixNormal);++ cx.simulate_keystroke("b");++ cx.assert_state("«ˇaa»\n", Mode::HelixNormal);+ }}