mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 10:29:35 +03:00
Make test more deterministic
Otherwise these pass only when --features=neovim is set
This commit is contained in:
parent
20f98e4d17
commit
f22d53eef9
@ -71,7 +71,7 @@ mod test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_dot_repeat(cx: &mut gpui::TestAppContext) {
|
async fn test_dot_repeat(deterministic: Arc<Deterministic>, cx: &mut gpui::TestAppContext) {
|
||||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||||
|
|
||||||
// "o"
|
// "o"
|
||||||
@ -80,26 +80,33 @@ mod test {
|
|||||||
.await;
|
.await;
|
||||||
cx.assert_shared_state("hello\nworlˇd").await;
|
cx.assert_shared_state("hello\nworlˇd").await;
|
||||||
cx.simulate_shared_keystrokes(["."]).await;
|
cx.simulate_shared_keystrokes(["."]).await;
|
||||||
|
deterministic.run_until_parked();
|
||||||
cx.assert_shared_state("hello\nworld\nworlˇd").await;
|
cx.assert_shared_state("hello\nworld\nworlˇd").await;
|
||||||
|
|
||||||
// "d"
|
// "d"
|
||||||
cx.simulate_shared_keystrokes(["^", "d", "f", "o"]).await;
|
cx.simulate_shared_keystrokes(["^", "d", "f", "o"]).await;
|
||||||
cx.simulate_shared_keystrokes(["g", "g", "."]).await;
|
cx.simulate_shared_keystrokes(["g", "g", "."]).await;
|
||||||
|
deterministic.run_until_parked();
|
||||||
cx.assert_shared_state("ˇ\nworld\nrld").await;
|
cx.assert_shared_state("ˇ\nworld\nrld").await;
|
||||||
|
|
||||||
// "p" (note that it pastes the current clipboard)
|
// "p" (note that it pastes the current clipboard)
|
||||||
cx.simulate_shared_keystrokes(["j", "y", "y", "p"]).await;
|
cx.simulate_shared_keystrokes(["j", "y", "y", "p"]).await;
|
||||||
cx.simulate_shared_keystrokes(["shift-g", "y", "y", "."])
|
cx.simulate_shared_keystrokes(["shift-g", "y", "y", "."])
|
||||||
.await;
|
.await;
|
||||||
|
deterministic.run_until_parked();
|
||||||
cx.assert_shared_state("\nworld\nworld\nrld\nˇrld").await;
|
cx.assert_shared_state("\nworld\nworld\nrld\nˇrld").await;
|
||||||
|
|
||||||
// "~" (note that counts apply to the action taken, not . itself)
|
// "~" (note that counts apply to the action taken, not . itself)
|
||||||
cx.set_shared_state("ˇthe quick brown fox").await;
|
cx.set_shared_state("ˇthe quick brown fox").await;
|
||||||
cx.simulate_shared_keystrokes(["2", "~", "."]).await;
|
cx.simulate_shared_keystrokes(["2", "~", "."]).await;
|
||||||
|
deterministic.run_until_parked();
|
||||||
cx.set_shared_state("THE ˇquick brown fox").await;
|
cx.set_shared_state("THE ˇquick brown fox").await;
|
||||||
cx.simulate_shared_keystrokes(["3", "."]).await;
|
cx.simulate_shared_keystrokes(["3", "."]).await;
|
||||||
|
deterministic.run_until_parked();
|
||||||
cx.set_shared_state("THE QUIˇck brown fox").await;
|
cx.set_shared_state("THE QUIˇck brown fox").await;
|
||||||
|
deterministic.run_until_parked();
|
||||||
cx.simulate_shared_keystrokes(["."]).await;
|
cx.simulate_shared_keystrokes(["."]).await;
|
||||||
|
deterministic.run_until_parked();
|
||||||
cx.set_shared_state("THE QUICK ˇbrown fox").await;
|
cx.set_shared_state("THE QUICK ˇbrown fox").await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user