All the easy tests?
This commit is contained in:
parent
1e89092d62
commit
3baf125f4a
4 changed files with 753 additions and 749 deletions
|
@ -36,100 +36,90 @@ fn normal_before(_: &mut Workspace, action: &NormalBefore, cx: &mut ViewContext<
|
|||
}
|
||||
}
|
||||
|
||||
// #[cfg(test)]
|
||||
// mod test {
|
||||
// use std::sync::Arc;
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::{
|
||||
state::Mode,
|
||||
test::{NeovimBackedTestContext, VimTestContext},
|
||||
};
|
||||
|
||||
// use gpui::executor::Deterministic;
|
||||
#[gpui::test]
|
||||
async fn test_enter_and_exit_insert_mode(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = VimTestContext::new(cx, true).await;
|
||||
cx.simulate_keystroke("i");
|
||||
assert_eq!(cx.mode(), Mode::Insert);
|
||||
cx.simulate_keystrokes(["T", "e", "s", "t"]);
|
||||
cx.assert_editor_state("Testˇ");
|
||||
cx.simulate_keystroke("escape");
|
||||
assert_eq!(cx.mode(), Mode::Normal);
|
||||
cx.assert_editor_state("Tesˇt");
|
||||
}
|
||||
|
||||
// use crate::{
|
||||
// state::Mode,
|
||||
// test::{NeovimBackedTestContext, VimTestContext},
|
||||
// };
|
||||
#[gpui::test]
|
||||
async fn test_insert_with_counts(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
// #[gpui::test]
|
||||
// async fn test_enter_and_exit_insert_mode(cx: &mut gpui::TestAppContext) {
|
||||
// let mut cx = VimTestContext::new(cx, true).await;
|
||||
// cx.simulate_keystroke("i");
|
||||
// assert_eq!(cx.mode(), Mode::Insert);
|
||||
// cx.simulate_keystrokes(["T", "e", "s", "t"]);
|
||||
// cx.assert_editor_state("Testˇ");
|
||||
// cx.simulate_keystroke("escape");
|
||||
// assert_eq!(cx.mode(), Mode::Normal);
|
||||
// cx.assert_editor_state("Tesˇt");
|
||||
// }
|
||||
cx.set_shared_state("ˇhello\n").await;
|
||||
cx.simulate_shared_keystrokes(["5", "i", "-", "escape"])
|
||||
.await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("----ˇ-hello\n").await;
|
||||
|
||||
// #[gpui::test]
|
||||
// async fn test_insert_with_counts(
|
||||
// deterministic: Arc<Deterministic>,
|
||||
// cx: &mut gpui::TestAppContext,
|
||||
// ) {
|
||||
// let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
cx.set_shared_state("ˇhello\n").await;
|
||||
cx.simulate_shared_keystrokes(["5", "a", "-", "escape"])
|
||||
.await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("h----ˇ-ello\n").await;
|
||||
|
||||
// cx.set_shared_state("ˇhello\n").await;
|
||||
// cx.simulate_shared_keystrokes(["5", "i", "-", "escape"])
|
||||
// .await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("----ˇ-hello\n").await;
|
||||
cx.simulate_shared_keystrokes(["4", "shift-i", "-", "escape"])
|
||||
.await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("---ˇ-h-----ello\n").await;
|
||||
|
||||
// cx.set_shared_state("ˇhello\n").await;
|
||||
// cx.simulate_shared_keystrokes(["5", "a", "-", "escape"])
|
||||
// .await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("h----ˇ-ello\n").await;
|
||||
cx.simulate_shared_keystrokes(["3", "shift-a", "-", "escape"])
|
||||
.await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("----h-----ello--ˇ-\n").await;
|
||||
|
||||
// cx.simulate_shared_keystrokes(["4", "shift-i", "-", "escape"])
|
||||
// .await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("---ˇ-h-----ello\n").await;
|
||||
cx.set_shared_state("ˇhello\n").await;
|
||||
cx.simulate_shared_keystrokes(["3", "o", "o", "i", "escape"])
|
||||
.await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("hello\noi\noi\noˇi\n").await;
|
||||
|
||||
// cx.simulate_shared_keystrokes(["3", "shift-a", "-", "escape"])
|
||||
// .await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("----h-----ello--ˇ-\n").await;
|
||||
cx.set_shared_state("ˇhello\n").await;
|
||||
cx.simulate_shared_keystrokes(["3", "shift-o", "o", "i", "escape"])
|
||||
.await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("oi\noi\noˇi\nhello\n").await;
|
||||
}
|
||||
|
||||
// cx.set_shared_state("ˇhello\n").await;
|
||||
// cx.simulate_shared_keystrokes(["3", "o", "o", "i", "escape"])
|
||||
// .await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("hello\noi\noi\noˇi\n").await;
|
||||
#[gpui::test]
|
||||
async fn test_insert_with_repeat(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
// cx.set_shared_state("ˇhello\n").await;
|
||||
// cx.simulate_shared_keystrokes(["3", "shift-o", "o", "i", "escape"])
|
||||
// .await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("oi\noi\noˇi\nhello\n").await;
|
||||
// }
|
||||
cx.set_shared_state("ˇhello\n").await;
|
||||
cx.simulate_shared_keystrokes(["3", "i", "-", "escape"])
|
||||
.await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("--ˇ-hello\n").await;
|
||||
cx.simulate_shared_keystrokes(["."]).await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("----ˇ--hello\n").await;
|
||||
cx.simulate_shared_keystrokes(["2", "."]).await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("-----ˇ---hello\n").await;
|
||||
|
||||
// #[gpui::test]
|
||||
// async fn test_insert_with_repeat(
|
||||
// deterministic: Arc<Deterministic>,
|
||||
// cx: &mut gpui::TestAppContext,
|
||||
// ) {
|
||||
// let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
// cx.set_shared_state("ˇhello\n").await;
|
||||
// cx.simulate_shared_keystrokes(["3", "i", "-", "escape"])
|
||||
// .await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("--ˇ-hello\n").await;
|
||||
// cx.simulate_shared_keystrokes(["."]).await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("----ˇ--hello\n").await;
|
||||
// cx.simulate_shared_keystrokes(["2", "."]).await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("-----ˇ---hello\n").await;
|
||||
|
||||
// cx.set_shared_state("ˇhello\n").await;
|
||||
// cx.simulate_shared_keystrokes(["2", "o", "k", "k", "escape"])
|
||||
// .await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("hello\nkk\nkˇk\n").await;
|
||||
// cx.simulate_shared_keystrokes(["."]).await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("hello\nkk\nkk\nkk\nkˇk\n").await;
|
||||
// cx.simulate_shared_keystrokes(["1", "."]).await;
|
||||
// deterministic.run_until_parked();
|
||||
// cx.assert_shared_state("hello\nkk\nkk\nkk\nkk\nkˇk\n").await;
|
||||
// }
|
||||
// }
|
||||
cx.set_shared_state("ˇhello\n").await;
|
||||
cx.simulate_shared_keystrokes(["2", "o", "k", "k", "escape"])
|
||||
.await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("hello\nkk\nkˇk\n").await;
|
||||
cx.simulate_shared_keystrokes(["."]).await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("hello\nkk\nkk\nkk\nkˇk\n").await;
|
||||
cx.simulate_shared_keystrokes(["1", "."]).await;
|
||||
cx.run_until_parked();
|
||||
cx.assert_shared_state("hello\nkk\nkk\nkk\nkk\nkˇk\n").await;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue