vim test redux (#11709)

This cleans up the neovim-backed vim tests:
- removed exempted tests (we'll rely on bug reports to find missing edge
cases)
- moved all assertions into non-async fn's so that failures are
reporting on the right file/line
- removed the NeovimBackedBindingTestContext
- renamed a few things to make them clearer
- reduced the number of permutations tested in some cases to reduce
slowest test from 60s to 5s

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-05-11 12:04:05 -06:00 committed by GitHub
parent 48cba328f2
commit f550f23b97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 2311 additions and 6505 deletions

View file

@ -597,33 +597,32 @@ mod test {
// entering visual mode should select the character
// under cursor
cx.simulate_shared_keystrokes(["v"]).await;
cx.assert_shared_state(indoc! { "The «qˇ»uick brown
cx.simulate_shared_keystrokes("v").await;
cx.shared_state()
.await
.assert_eq(indoc! { "The «qˇ»uick brown
fox jumps over
the lazy dog"})
.await;
the lazy dog"});
cx.update_editor(|editor, cx| assert_eq!(cursor, editor.pixel_position_of_cursor(cx)));
// forwards motions should extend the selection
cx.simulate_shared_keystrokes(["w", "j"]).await;
cx.assert_shared_state(indoc! { "The «quick brown
cx.simulate_shared_keystrokes("w j").await;
cx.shared_state().await.assert_eq(indoc! { "The «quick brown
fox jumps »ver
the lazy dog"})
.await;
the lazy dog"});
cx.simulate_shared_keystrokes(["escape"]).await;
assert_eq!(Mode::Normal, cx.neovim_mode().await);
cx.assert_shared_state(indoc! { "The quick brown
cx.simulate_shared_keystrokes("escape").await;
cx.shared_state().await.assert_eq(indoc! { "The quick brown
fox jumps ˇover
the lazy dog"})
.await;
the lazy dog"});
// motions work backwards
cx.simulate_shared_keystrokes(["v", "k", "b"]).await;
cx.assert_shared_state(indoc! { "The «ˇquick brown
cx.simulate_shared_keystrokes("v k b").await;
cx.shared_state()
.await
.assert_eq(indoc! { "The «ˇquick brown
fox jumps o»ver
the lazy dog"})
.await;
the lazy dog"});
// works on empty lines
cx.set_shared_state(indoc! {"
@ -633,23 +632,21 @@ mod test {
"})
.await;
let cursor = cx.update_editor(|editor, cx| editor.pixel_position_of_cursor(cx));
cx.simulate_shared_keystrokes(["v"]).await;
cx.assert_shared_state(indoc! {"
cx.simulate_shared_keystrokes("v").await;
cx.shared_state().await.assert_eq(indoc! {"
a
«
ˇ»b
"})
.await;
"});
cx.update_editor(|editor, cx| assert_eq!(cursor, editor.pixel_position_of_cursor(cx)));
// toggles off again
cx.simulate_shared_keystrokes(["v"]).await;
cx.assert_shared_state(indoc! {"
cx.simulate_shared_keystrokes("v").await;
cx.shared_state().await.assert_eq(indoc! {"
a
ˇ
b
"})
.await;
"});
// works at the end of a document
cx.set_shared_state(indoc! {"
@ -658,13 +655,11 @@ mod test {
ˇ"})
.await;
cx.simulate_shared_keystrokes(["v"]).await;
cx.assert_shared_state(indoc! {"
cx.simulate_shared_keystrokes("v").await;
cx.shared_state().await.assert_eq(indoc! {"
a
b
ˇ"})
.await;
assert_eq!(cx.mode(), cx.neovim_mode().await);
ˇ"});
}
#[gpui::test]
@ -677,16 +672,15 @@ mod test {
the lazy dog"
})
.await;
cx.simulate_shared_keystrokes(["shift-v"]).await;
cx.assert_shared_state(indoc! { "The «qˇ»uick brown
cx.simulate_shared_keystrokes("shift-v").await;
cx.shared_state()
.await
.assert_eq(indoc! { "The «qˇ»uick brown
fox jumps over
the lazy dog"})
.await;
assert_eq!(cx.mode(), cx.neovim_mode().await);
cx.simulate_shared_keystrokes(["x"]).await;
cx.assert_shared_state(indoc! { "fox ˇjumps over
the lazy dog"})
.await;
the lazy dog"});
cx.simulate_shared_keystrokes("x").await;
cx.shared_state().await.assert_eq(indoc! { "fox ˇjumps over
the lazy dog"});
// it should work on empty lines
cx.set_shared_state(indoc! {"
@ -694,17 +688,15 @@ mod test {
ˇ
b"})
.await;
cx.simulate_shared_keystrokes(["shift-v"]).await;
cx.assert_shared_state(indoc! { "
cx.simulate_shared_keystrokes("shift-v").await;
cx.shared_state().await.assert_eq(indoc! {"
a
«
ˇ»b"})
.await;
cx.simulate_shared_keystrokes(["x"]).await;
cx.assert_shared_state(indoc! { "
ˇ»b"});
cx.simulate_shared_keystrokes("x").await;
cx.shared_state().await.assert_eq(indoc! {"
a
ˇb"})
.await;
ˇb"});
// it should work at the end of the document
cx.set_shared_state(indoc! {"
@ -713,54 +705,60 @@ mod test {
ˇ"})
.await;
let cursor = cx.update_editor(|editor, cx| editor.pixel_position_of_cursor(cx));
cx.simulate_shared_keystrokes(["shift-v"]).await;
cx.assert_shared_state(indoc! {"
cx.simulate_shared_keystrokes("shift-v").await;
cx.shared_state().await.assert_eq(indoc! {"
a
b
ˇ"})
.await;
assert_eq!(cx.mode(), cx.neovim_mode().await);
ˇ"});
cx.update_editor(|editor, cx| assert_eq!(cursor, editor.pixel_position_of_cursor(cx)));
cx.simulate_shared_keystrokes(["x"]).await;
cx.assert_shared_state(indoc! {"
cx.simulate_shared_keystrokes("x").await;
cx.shared_state().await.assert_eq(indoc! {"
a
ˇb"})
.await;
ˇb"});
}
#[gpui::test]
async fn test_visual_delete(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.assert_binding_matches(["v", "w"], "The quick ˇbrown")
.await;
cx.simulate("v w", "The quick ˇbrown")
.await
.assert_matches();
cx.assert_binding_matches(["v", "w", "x"], "The quick ˇbrown")
.await;
cx.assert_binding_matches(
["v", "w", "j", "x"],
cx.simulate("v w x", "The quick ˇbrown")
.await
.assert_matches();
cx.simulate(
"v w j x",
indoc! {"
The ˇquick brown
fox jumps over
the lazy dog"},
)
.await;
.await
.assert_matches();
// Test pasting code copied on delete
cx.simulate_shared_keystrokes(["j", "p"]).await;
cx.assert_state_matches().await;
cx.simulate_shared_keystrokes("j p").await;
cx.shared_state().await.assert_matches();
let mut cx = cx.binding(["v", "w", "j", "x"]);
cx.assert_all(indoc! {"
cx.simulate_at_each_offset(
"v w j x",
indoc! {"
The ˇquick brown
fox jumps over
the ˇlazy dog"})
.await;
let mut cx = cx.binding(["v", "b", "k", "x"]);
cx.assert_all(indoc! {"
the ˇlazy dog"},
)
.await
.assert_matches();
cx.simulate_at_each_offset(
"v b k x",
indoc! {"
The ˇquick brown
fox jumps ˇover
the ˇlazy dog"})
.await;
the ˇlazy dog"},
)
.await
.assert_matches();
}
#[gpui::test]
@ -772,34 +770,32 @@ mod test {
fox jumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes(["shift-v", "x"]).await;
cx.assert_state_matches().await;
cx.simulate_shared_keystrokes("shift-v x").await;
cx.shared_state().await.assert_matches();
// Test pasting code copied on delete
cx.simulate_shared_keystroke("p").await;
cx.assert_state_matches().await;
cx.simulate_shared_keystrokes("p").await;
cx.shared_state().await.assert_matches();
cx.set_shared_state(indoc! {"
The quick brown
fox jumps over
the laˇzy dog"})
.await;
cx.simulate_shared_keystrokes(["shift-v", "x"]).await;
cx.assert_state_matches().await;
cx.assert_shared_clipboard("the lazy dog\n").await;
cx.simulate_shared_keystrokes("shift-v x").await;
cx.shared_state().await.assert_matches();
cx.shared_clipboard().await.assert_eq("the lazy dog\n");
for marked_text in cx.each_marked_position(indoc! {"
The quˇick brown
fox jumps over
the lazy dog"})
{
cx.set_shared_state(&marked_text).await;
cx.simulate_shared_keystrokes(["shift-v", "j", "x"]).await;
cx.assert_state_matches().await;
// Test pasting code copied on delete
cx.simulate_shared_keystroke("p").await;
cx.assert_state_matches().await;
}
cx.set_shared_state(indoc! {"
The quˇick brown
fox jumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes("shift-v j x").await;
cx.shared_state().await.assert_matches();
// Test pasting code copied on delete
cx.simulate_shared_keystrokes("p").await;
cx.shared_state().await.assert_matches();
cx.set_shared_state(indoc! {"
The ˇlong line
@ -807,8 +803,8 @@ mod test {
crash
"})
.await;
cx.simulate_shared_keystrokes(["shift-v", "$", "x"]).await;
cx.assert_state_matches().await;
cx.simulate_shared_keystrokes("shift-v $ x").await;
cx.shared_state().await.assert_matches();
}
#[gpui::test]
@ -816,53 +812,48 @@ mod test {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("The quick ˇbrown").await;
cx.simulate_shared_keystrokes(["v", "w", "y"]).await;
cx.assert_shared_state("The quick ˇbrown").await;
cx.assert_shared_clipboard("brown").await;
cx.simulate_shared_keystrokes("v w y").await;
cx.shared_state().await.assert_eq("The quick ˇbrown");
cx.shared_clipboard().await.assert_eq("brown");
cx.set_shared_state(indoc! {"
The ˇquick brown
fox jumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes(["v", "w", "j", "y"]).await;
cx.assert_shared_state(indoc! {"
cx.simulate_shared_keystrokes("v w j y").await;
cx.shared_state().await.assert_eq(indoc! {"
The ˇquick brown
fox jumps over
the lazy dog"})
.await;
cx.assert_shared_clipboard(indoc! {"
the lazy dog"});
cx.shared_clipboard().await.assert_eq(indoc! {"
quick brown
fox jumps o"})
.await;
fox jumps o"});
cx.set_shared_state(indoc! {"
The quick brown
fox jumps over
the ˇlazy dog"})
.await;
cx.simulate_shared_keystrokes(["v", "w", "j", "y"]).await;
cx.assert_shared_state(indoc! {"
cx.simulate_shared_keystrokes("v w j y").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick brown
fox jumps over
the ˇlazy dog"})
.await;
cx.assert_shared_clipboard("lazy d").await;
cx.simulate_shared_keystrokes(["shift-v", "y"]).await;
cx.assert_shared_clipboard("the lazy dog\n").await;
the ˇlazy dog"});
cx.shared_clipboard().await.assert_eq("lazy d");
cx.simulate_shared_keystrokes("shift-v y").await;
cx.shared_clipboard().await.assert_eq("the lazy dog\n");
let mut cx = cx.binding(["v", "b", "k", "y"]);
cx.set_shared_state(indoc! {"
The ˇquick brown
fox jumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes(["v", "b", "k", "y"]).await;
cx.assert_shared_state(indoc! {"
cx.simulate_shared_keystrokes("v b k y").await;
cx.shared_state().await.assert_eq(indoc! {"
ˇThe quick brown
fox jumps over
the lazy dog"})
.await;
the lazy dog"});
assert_eq!(
cx.read_from_clipboard()
.map(|item| item.text().clone())
@ -875,15 +866,15 @@ mod test {
fox ˇjumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes(["shift-v", "shift-g", "shift-y"])
cx.simulate_shared_keystrokes("shift-v shift-g shift-y")
.await;
cx.assert_shared_state(indoc! {"
cx.shared_state().await.assert_eq(indoc! {"
The quick brown
ˇfox jumps over
the lazy dog"})
.await;
cx.assert_shared_clipboard("fox jumps over\nthe lazy dog\n")
.await;
the lazy dog"});
cx.shared_clipboard()
.await
.assert_eq("fox jumps over\nthe lazy dog\n");
}
#[gpui::test]
@ -896,64 +887,56 @@ mod test {
the lazy dog"
})
.await;
cx.simulate_shared_keystrokes(["ctrl-v"]).await;
cx.assert_shared_state(indoc! {
cx.simulate_shared_keystrokes("ctrl-v").await;
cx.shared_state().await.assert_eq(indoc! {
"The «qˇ»uick brown
fox jumps over
the lazy dog"
})
.await;
cx.simulate_shared_keystrokes(["2", "down"]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("2 down").await;
cx.shared_state().await.assert_eq(indoc! {
"The «qˇ»uick brown
fox «»umps over
the «»azy dog"
})
.await;
cx.simulate_shared_keystrokes(["e"]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("e").await;
cx.shared_state().await.assert_eq(indoc! {
"The «quicˇ»k brown
fox «jumpˇ»s over
the «lazyˇ» dog"
})
.await;
cx.simulate_shared_keystrokes(["^"]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("^").await;
cx.shared_state().await.assert_eq(indoc! {
"«ˇThe q»uick brown
«ˇfox j»umps over
«ˇthe l»azy dog"
})
.await;
cx.simulate_shared_keystrokes(["$"]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("$").await;
cx.shared_state().await.assert_eq(indoc! {
"The «quick brownˇ»
fox «jumps overˇ»
the «lazy dogˇ»"
})
.await;
cx.simulate_shared_keystrokes(["shift-f", " "]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("shift-f space").await;
cx.shared_state().await.assert_eq(indoc! {
"The «quickˇ» brown
fox «jumpsˇ» over
the «lazy ˇ»dog"
})
.await;
});
// toggling through visual mode works as expected
cx.simulate_shared_keystrokes(["v"]).await;
cx.assert_shared_state(indoc! {
cx.simulate_shared_keystrokes("v").await;
cx.shared_state().await.assert_eq(indoc! {
"The «quick brown
fox jumps over
the lazy ˇ»dog"
})
.await;
cx.simulate_shared_keystrokes(["ctrl-v"]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("ctrl-v").await;
cx.shared_state().await.assert_eq(indoc! {
"The «quickˇ» brown
fox «jumpsˇ» over
the «lazy ˇ»dog"
})
.await;
});
cx.set_shared_state(indoc! {
"The ˇquick
@ -965,9 +948,8 @@ mod test {
"
})
.await;
cx.simulate_shared_keystrokes(["ctrl-v", "down", "down"])
.await;
cx.assert_shared_state(indoc! {
cx.simulate_shared_keystrokes("ctrl-v down down").await;
cx.shared_state().await.assert_eq(indoc! {
"The«ˇ q»uick
bro«ˇwn»
foxˇ
@ -975,10 +957,9 @@ mod test {
lazy dog
"
})
.await;
cx.simulate_shared_keystrokes(["down"]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("down").await;
cx.shared_state().await.assert_eq(indoc! {
"The «qˇ»uick
brow«»
fox
@ -986,10 +967,9 @@ mod test {
lazy dog
"
})
.await;
cx.simulate_shared_keystroke("left").await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("left").await;
cx.shared_state().await.assert_eq(indoc! {
"The«ˇ q»uick
bro«ˇwn»
foxˇ
@ -997,10 +977,9 @@ mod test {
lazy dog
"
})
.await;
cx.simulate_shared_keystrokes(["s", "o", "escape"]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("s o escape").await;
cx.shared_state().await.assert_eq(indoc! {
"Theˇouick
broo
foxo
@ -1008,8 +987,7 @@ mod test {
lazy dog
"
})
.await;
});
// https://github.com/zed-industries/zed/issues/6274
cx.set_shared_state(indoc! {
@ -1020,16 +998,14 @@ mod test {
"
})
.await;
cx.simulate_shared_keystrokes(["l", "ctrl-v", "j", "j"])
.await;
cx.assert_shared_state(indoc! {
cx.simulate_shared_keystrokes("l ctrl-v j j").await;
cx.shared_state().await.assert_eq(indoc! {
"The «qˇ»uick brown
fox «»umps over
the lazy dog
"
})
.await;
});
}
#[gpui::test]
@ -1043,15 +1019,13 @@ mod test {
"
})
.await;
cx.simulate_shared_keystrokes(["ctrl-v", "right", "down"])
.await;
cx.assert_shared_state(indoc! {
cx.simulate_shared_keystrokes("ctrl-v right down").await;
cx.shared_state().await.assert_eq(indoc! {
"The «quˇ»ick brown
fox «juˇ»mps over
the lazy dog
"
})
.await;
});
}
#[gpui::test]
@ -1065,24 +1039,21 @@ mod test {
"
})
.await;
cx.simulate_shared_keystrokes(["ctrl-v", "9", "down"]).await;
cx.assert_shared_state(indoc! {
cx.simulate_shared_keystrokes("ctrl-v 9 down").await;
cx.shared_state().await.assert_eq(indoc! {
"«Tˇ»he quick brown
«»ox jumps over
«»he lazy dog
ˇ"
})
.await;
});
cx.simulate_shared_keystrokes(["shift-i", "k", "escape"])
.await;
cx.assert_shared_state(indoc! {
cx.simulate_shared_keystrokes("shift-i k escape").await;
cx.shared_state().await.assert_eq(indoc! {
"ˇkThe quick brown
kfox jumps over
kthe lazy dog
k"
})
.await;
});
cx.set_shared_state(indoc! {
"ˇThe quick brown
@ -1091,22 +1062,20 @@ mod test {
"
})
.await;
cx.simulate_shared_keystrokes(["ctrl-v", "9", "down"]).await;
cx.assert_shared_state(indoc! {
cx.simulate_shared_keystrokes("ctrl-v 9 down").await;
cx.shared_state().await.assert_eq(indoc! {
"«Tˇ»he quick brown
«»ox jumps over
«»he lazy dog
ˇ"
})
.await;
cx.simulate_shared_keystrokes(["c", "k", "escape"]).await;
cx.assert_shared_state(indoc! {
});
cx.simulate_shared_keystrokes("c k escape").await;
cx.shared_state().await.assert_eq(indoc! {
"ˇkhe quick brown
kox jumps over
khe lazy dog
k"
})
.await;
});
}
#[gpui::test]
@ -1114,19 +1083,26 @@ mod test {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("hello (in [parˇens] o)").await;
cx.simulate_shared_keystrokes(["ctrl-v", "l"]).await;
cx.simulate_shared_keystrokes(["a", "]"]).await;
cx.assert_shared_state("hello (in «[parens]ˇ» o)").await;
cx.simulate_shared_keystrokes(["i", "("]).await;
cx.assert_shared_state("hello («in [parens] oˇ»)").await;
cx.simulate_shared_keystrokes("ctrl-v l").await;
cx.simulate_shared_keystrokes("a ]").await;
cx.shared_state()
.await
.assert_eq("hello (in «[parens]ˇ» o)");
cx.simulate_shared_keystrokes("i (").await;
cx.shared_state()
.await
.assert_eq("hello («in [parens] oˇ»)");
cx.set_shared_state("hello in a wˇord again.").await;
cx.simulate_shared_keystrokes(["ctrl-v", "l", "i", "w"])
.await;
cx.assert_shared_state("hello in a w«ordˇ» again.").await;
cx.simulate_shared_keystrokes("ctrl-v l i w").await;
cx.shared_state()
.await
.assert_eq("hello in a w«ordˇ» again.");
assert_eq!(cx.mode(), Mode::VisualBlock);
cx.simulate_shared_keystrokes(["o", "a", "s"]).await;
cx.assert_shared_state("«ˇhello in a word» again.").await;
cx.simulate_shared_keystrokes("o a s").await;
cx.shared_state()
.await
.assert_eq("«ˇhello in a word» again.");
}
#[gpui::test]
@ -1134,9 +1110,9 @@ mod test {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state("aˇbc", Mode::Normal);
cx.simulate_keystrokes(["ctrl-v"]);
cx.simulate_keystrokes("ctrl-v");
assert_eq!(cx.mode(), Mode::VisualBlock);
cx.simulate_keystrokes(["cmd-shift-p", "escape"]);
cx.simulate_keystrokes("cmd-shift-p escape");
assert_eq!(cx.mode(), Mode::VisualBlock);
}
@ -1145,32 +1121,28 @@ mod test {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("aaˇ aa aa aa aa").await;
cx.simulate_shared_keystrokes(["/", "a", "a", "enter"])
.await;
cx.assert_shared_state("aa ˇaa aa aa aa").await;
cx.simulate_shared_keystrokes(["g", "n"]).await;
cx.assert_shared_state("aa «aaˇ» aa aa aa").await;
cx.simulate_shared_keystrokes(["g", "n"]).await;
cx.assert_shared_state("aa «aa aaˇ» aa aa").await;
cx.simulate_shared_keystrokes(["escape", "d", "g", "n"])
.await;
cx.assert_shared_state("aa aa ˇ aa aa").await;
cx.simulate_shared_keystrokes("/ a a enter").await;
cx.shared_state().await.assert_eq("aa ˇaa aa aa aa");
cx.simulate_shared_keystrokes("g n").await;
cx.shared_state().await.assert_eq("aa «aaˇ» aa aa aa");
cx.simulate_shared_keystrokes("g n").await;
cx.shared_state().await.assert_eq("aa «aa aaˇ» aa aa");
cx.simulate_shared_keystrokes("escape d g n").await;
cx.shared_state().await.assert_eq("aa aa ˇ aa aa");
cx.set_shared_state("aaˇ aa aa aa aa").await;
cx.simulate_shared_keystrokes(["/", "a", "a", "enter"])
.await;
cx.assert_shared_state("aa ˇaa aa aa aa").await;
cx.simulate_shared_keystrokes(["3", "g", "n"]).await;
cx.assert_shared_state("aa aa aa «aaˇ» aa").await;
cx.simulate_shared_keystrokes("/ a a enter").await;
cx.shared_state().await.assert_eq("aa ˇaa aa aa aa");
cx.simulate_shared_keystrokes("3 g n").await;
cx.shared_state().await.assert_eq("aa aa aa «aaˇ» aa");
cx.set_shared_state("aaˇ aa aa aa aa").await;
cx.simulate_shared_keystrokes(["/", "a", "a", "enter"])
.await;
cx.assert_shared_state("aa ˇaa aa aa aa").await;
cx.simulate_shared_keystrokes(["g", "shift-n"]).await;
cx.assert_shared_state("aa «ˇaa» aa aa aa").await;
cx.simulate_shared_keystrokes(["g", "shift-n"]).await;
cx.assert_shared_state("«ˇaa aa» aa aa aa").await;
cx.simulate_shared_keystrokes("/ a a enter").await;
cx.shared_state().await.assert_eq("aa ˇaa aa aa aa");
cx.simulate_shared_keystrokes("g shift-n").await;
cx.shared_state().await.assert_eq("aa «ˇaa» aa aa aa");
cx.simulate_shared_keystrokes("g shift-n").await;
cx.shared_state().await.assert_eq("«ˇaa aa» aa aa aa");
}
#[gpui::test]
@ -1178,16 +1150,15 @@ mod test {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("aaˇ aa aa aa aa").await;
cx.simulate_shared_keystrokes(["/", "a", "a", "enter"])
.await;
cx.assert_shared_state("aa ˇaa aa aa aa").await;
cx.simulate_shared_keystrokes(["d", "g", "n"]).await;
cx.simulate_shared_keystrokes("/ a a enter").await;
cx.shared_state().await.assert_eq("aa ˇaa aa aa aa");
cx.simulate_shared_keystrokes("d g n").await;
cx.assert_shared_state("aa ˇ aa aa aa").await;
cx.simulate_shared_keystrokes(["."]).await;
cx.assert_shared_state("aa ˇ aa aa").await;
cx.simulate_shared_keystrokes(["."]).await;
cx.assert_shared_state("aa ˇ aa").await;
cx.shared_state().await.assert_eq("aa ˇ aa aa aa");
cx.simulate_shared_keystrokes(".").await;
cx.shared_state().await.assert_eq("aa ˇ aa aa");
cx.simulate_shared_keystrokes(".").await;
cx.shared_state().await.assert_eq("aa ˇ aa");
}
#[gpui::test]
@ -1195,14 +1166,12 @@ mod test {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("aaˇ aa aa aa aa").await;
cx.simulate_shared_keystrokes(["/", "a", "a", "enter"])
.await;
cx.assert_shared_state("aa ˇaa aa aa aa").await;
cx.simulate_shared_keystrokes(["c", "g", "n", "x", "escape"])
.await;
cx.assert_shared_state("aa ˇx aa aa aa").await;
cx.simulate_shared_keystrokes(["."]).await;
cx.assert_shared_state("aa x ˇx aa aa").await;
cx.simulate_shared_keystrokes("/ a a enter").await;
cx.shared_state().await.assert_eq("aa ˇaa aa aa aa");
cx.simulate_shared_keystrokes("c g n x escape").await;
cx.shared_state().await.assert_eq("aa ˇx aa aa aa");
cx.simulate_shared_keystrokes(".").await;
cx.shared_state().await.assert_eq("aa x ˇx aa aa");
}
#[gpui::test]
@ -1210,23 +1179,19 @@ mod test {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("aaˇ aa aa aa aa").await;
cx.simulate_shared_keystrokes(["/", "b", "b", "enter"])
.await;
cx.assert_shared_state("aaˇ aa aa aa aa").await;
cx.simulate_shared_keystrokes(["c", "g", "n", "x", "escape"])
.await;
cx.assert_shared_state("aaˇaa aa aa aa").await;
cx.simulate_shared_keystrokes(["."]).await;
cx.assert_shared_state("aaˇa aa aa aa").await;
cx.simulate_shared_keystrokes("/ b b enter").await;
cx.shared_state().await.assert_eq("aaˇ aa aa aa aa");
cx.simulate_shared_keystrokes("c g n x escape").await;
cx.shared_state().await.assert_eq("aaˇaa aa aa aa");
cx.simulate_shared_keystrokes(".").await;
cx.shared_state().await.assert_eq("aaˇa aa aa aa");
cx.set_shared_state("aaˇ bb aa aa aa").await;
cx.simulate_shared_keystrokes(["/", "b", "b", "enter"])
.await;
cx.assert_shared_state("aa ˇbb aa aa aa").await;
cx.simulate_shared_keystrokes(["c", "g", "n", "x", "escape"])
.await;
cx.assert_shared_state("aa ˇx aa aa aa").await;
cx.simulate_shared_keystrokes(["."]).await;
cx.assert_shared_state("aa ˇx aa aa aa").await;
cx.simulate_shared_keystrokes("/ b b enter").await;
cx.shared_state().await.assert_eq("aa ˇbb aa aa aa");
cx.simulate_shared_keystrokes("c g n x escape").await;
cx.shared_state().await.assert_eq("aa ˇx aa aa aa");
cx.simulate_shared_keystrokes(".").await;
cx.shared_state().await.assert_eq("aa ˇx aa aa aa");
}
}