helix: Add more tests (#33582)
These tests cover more edge cases Release Notes: - N/A
This commit is contained in:
parent
2680a78f9c
commit
d10cc13924
1 changed files with 45 additions and 2 deletions
|
@ -302,14 +302,14 @@ mod test {
|
||||||
use crate::{state::Mode, test::VimTestContext};
|
use crate::{state::Mode, test::VimTestContext};
|
||||||
|
|
||||||
#[gpui::test]
|
#[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;
|
let mut cx = VimTestContext::new(cx, true).await;
|
||||||
// «
|
// «
|
||||||
// ˇ
|
// ˇ
|
||||||
// »
|
// »
|
||||||
cx.set_state(
|
cx.set_state(
|
||||||
indoc! {"
|
indoc! {"
|
||||||
The quˇick brown
|
Th«e quiˇ»ck brown
|
||||||
fox jumps over
|
fox jumps over
|
||||||
the lazy dog."},
|
the lazy dog."},
|
||||||
Mode::HelixNormal,
|
Mode::HelixNormal,
|
||||||
|
@ -334,6 +334,32 @@ mod test {
|
||||||
the lazy dog."},
|
the lazy dog."},
|
||||||
Mode::HelixNormal,
|
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]
|
// #[gpui::test]
|
||||||
|
@ -448,4 +474,21 @@ mod test {
|
||||||
Mode::HelixNormal,
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue