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:
parent
48cba328f2
commit
f550f23b97
38 changed files with 2311 additions and 6505 deletions
|
@ -404,15 +404,14 @@ mod test {
|
|||
c"})
|
||||
.await;
|
||||
|
||||
cx.simulate_shared_keystrokes([":", "j", "enter"]).await;
|
||||
cx.simulate_shared_keystrokes(": j enter").await;
|
||||
|
||||
// hack: our cursor positionining after a join command is wrong
|
||||
cx.simulate_shared_keystrokes(["^"]).await;
|
||||
cx.assert_shared_state(indoc! {
|
||||
cx.simulate_shared_keystrokes("^").await;
|
||||
cx.shared_state().await.assert_eq(indoc! {
|
||||
"ˇa b
|
||||
c"
|
||||
})
|
||||
.await;
|
||||
});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -424,12 +423,11 @@ mod test {
|
|||
b
|
||||
c"})
|
||||
.await;
|
||||
cx.simulate_shared_keystrokes([":", "3", "enter"]).await;
|
||||
cx.assert_shared_state(indoc! {"
|
||||
cx.simulate_shared_keystrokes(": 3 enter").await;
|
||||
cx.shared_state().await.assert_eq(indoc! {"
|
||||
a
|
||||
b
|
||||
ˇc"})
|
||||
.await;
|
||||
ˇc"});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -441,22 +439,17 @@ mod test {
|
|||
b
|
||||
c"})
|
||||
.await;
|
||||
cx.simulate_shared_keystrokes([":", "%", "s", "/", "b", "/", "d", "enter"])
|
||||
.await;
|
||||
cx.assert_shared_state(indoc! {"
|
||||
cx.simulate_shared_keystrokes(": % s / b / d enter").await;
|
||||
cx.shared_state().await.assert_eq(indoc! {"
|
||||
a
|
||||
ˇd
|
||||
c"})
|
||||
c"});
|
||||
cx.simulate_shared_keystrokes(": % s : . : \\ 0 \\ 0 enter")
|
||||
.await;
|
||||
cx.simulate_shared_keystrokes([
|
||||
":", "%", "s", ":", ".", ":", "\\", "0", "\\", "0", "enter",
|
||||
])
|
||||
.await;
|
||||
cx.assert_shared_state(indoc! {"
|
||||
cx.shared_state().await.assert_eq(indoc! {"
|
||||
aa
|
||||
dd
|
||||
ˇcc"})
|
||||
.await;
|
||||
ˇcc"});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -469,22 +462,18 @@ mod test {
|
|||
a
|
||||
c"})
|
||||
.await;
|
||||
cx.simulate_shared_keystrokes([":", "/", "b", "enter"])
|
||||
.await;
|
||||
cx.assert_shared_state(indoc! {"
|
||||
cx.simulate_shared_keystrokes(": / b enter").await;
|
||||
cx.shared_state().await.assert_eq(indoc! {"
|
||||
a
|
||||
ˇb
|
||||
a
|
||||
c"})
|
||||
.await;
|
||||
cx.simulate_shared_keystrokes([":", "?", "a", "enter"])
|
||||
.await;
|
||||
cx.assert_shared_state(indoc! {"
|
||||
c"});
|
||||
cx.simulate_shared_keystrokes(": ? a enter").await;
|
||||
cx.shared_state().await.assert_eq(indoc! {"
|
||||
ˇa
|
||||
b
|
||||
a
|
||||
c"})
|
||||
.await;
|
||||
c"});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -493,23 +482,23 @@ mod test {
|
|||
let path = Path::new("/root/dir/file.rs");
|
||||
let fs = cx.workspace(|workspace, cx| workspace.project().read(cx).fs().clone());
|
||||
|
||||
cx.simulate_keystrokes(["i", "@", "escape"]);
|
||||
cx.simulate_keystrokes([":", "w", "enter"]);
|
||||
cx.simulate_keystrokes("i @ escape");
|
||||
cx.simulate_keystrokes(": w enter");
|
||||
|
||||
assert_eq!(fs.load(&path).await.unwrap(), "@\n");
|
||||
|
||||
fs.as_fake().insert_file(path, b"oops\n".to_vec()).await;
|
||||
|
||||
// conflict!
|
||||
cx.simulate_keystrokes(["i", "@", "escape"]);
|
||||
cx.simulate_keystrokes([":", "w", "enter"]);
|
||||
cx.simulate_keystrokes("i @ escape");
|
||||
cx.simulate_keystrokes(": w enter");
|
||||
assert!(cx.has_pending_prompt());
|
||||
// "Cancel"
|
||||
cx.simulate_prompt_answer(0);
|
||||
assert_eq!(fs.load(&path).await.unwrap(), "oops\n");
|
||||
assert!(!cx.has_pending_prompt());
|
||||
// force overwrite
|
||||
cx.simulate_keystrokes([":", "w", "!", "enter"]);
|
||||
cx.simulate_keystrokes(": w ! enter");
|
||||
assert!(!cx.has_pending_prompt());
|
||||
assert_eq!(fs.load(&path).await.unwrap(), "@@\n");
|
||||
}
|
||||
|
@ -518,13 +507,13 @@ mod test {
|
|||
async fn test_command_quit(cx: &mut TestAppContext) {
|
||||
let mut cx = VimTestContext::new(cx, true).await;
|
||||
|
||||
cx.simulate_keystrokes([":", "n", "e", "w", "enter"]);
|
||||
cx.simulate_keystrokes(": n e w enter");
|
||||
cx.workspace(|workspace, cx| assert_eq!(workspace.items(cx).count(), 2));
|
||||
cx.simulate_keystrokes([":", "q", "enter"]);
|
||||
cx.simulate_keystrokes(": q enter");
|
||||
cx.workspace(|workspace, cx| assert_eq!(workspace.items(cx).count(), 1));
|
||||
cx.simulate_keystrokes([":", "n", "e", "w", "enter"]);
|
||||
cx.simulate_keystrokes(": n e w enter");
|
||||
cx.workspace(|workspace, cx| assert_eq!(workspace.items(cx).count(), 2));
|
||||
cx.simulate_keystrokes([":", "q", "a", "enter"]);
|
||||
cx.simulate_keystrokes(": q a enter");
|
||||
cx.workspace(|workspace, cx| assert_eq!(workspace.items(cx).count(), 0));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue