Skip to content

Commit

Permalink
vim: Visual test added
Browse files Browse the repository at this point in the history
  • Loading branch information
axelcarl committed Nov 9, 2024
1 parent 11f8385 commit f89ef10
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/vim/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,17 @@ async fn test_sentence_forwards(cx: &mut gpui::TestAppContext) {
cx.set_shared_state("helˇlo.\n\n\nworld.").await;
}

#[gpui::test]
async fn test_ctrl_o_visual(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;

cx.set_shared_state("helloˇ world.").await;
cx.simulate_shared_keystrokes("i ctrl-o v b r l").await;
cx.shared_state().await.assert_eq("ˇllllllworld.");
cx.simulate_shared_keystrokes("ctrl-o v f w d").await;
cx.shared_state().await.assert_eq("ˇorld.");
}

#[gpui::test]
async fn test_ctrl_o_position(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
Expand Down
14 changes: 14 additions & 0 deletions crates/vim/test_data/test_ctrl_o_visual.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{"Put":{"state":"helloˇ world."}}
{"Key":"i"}
{"Key":"ctrl-o"}
{"Key":"v"}
{"Key":"b"}
{"Key":"r"}
{"Key":"l"}
{"Get":{"state":"ˇllllllworld.","mode":"Insert"}}
{"Key":"ctrl-o"}
{"Key":"v"}
{"Key":"f"}
{"Key":"w"}
{"Key":"d"}
{"Get":{"state":"ˇorld.","mode":"Insert"}}

0 comments on commit f89ef10

Please sign in to comment.