MOAR TESTS

This commit is contained in:
Conrad Irwin
2023-12-11 15:06:33 -07:00
parent 303189e086
commit 1e89092d62
8 changed files with 1215 additions and 1200 deletions
+91 -91
View File
@@ -173,106 +173,106 @@ fn find_number(
}
}
// #[cfg(test)]
// mod test {
// use indoc::indoc;
#[cfg(test)]
mod test {
use indoc::indoc;
// use crate::test::NeovimBackedTestContext;
use crate::test::NeovimBackedTestContext;
// #[gpui::test]
// async fn test_increment(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await;
#[gpui::test]
async fn test_increment(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// cx.set_shared_state(indoc! {"
// 1ˇ2
// "})
// .await;
cx.set_shared_state(indoc! {"
1ˇ2
"})
.await;
// cx.simulate_shared_keystrokes(["ctrl-a"]).await;
// cx.assert_shared_state(indoc! {"
// 1ˇ3
// "})
// .await;
// cx.simulate_shared_keystrokes(["ctrl-x"]).await;
// cx.assert_shared_state(indoc! {"
// 1ˇ2
// "})
// .await;
cx.simulate_shared_keystrokes(["ctrl-a"]).await;
cx.assert_shared_state(indoc! {"
1ˇ3
"})
.await;
cx.simulate_shared_keystrokes(["ctrl-x"]).await;
cx.assert_shared_state(indoc! {"
1ˇ2
"})
.await;
// cx.simulate_shared_keystrokes(["9", "9", "ctrl-a"]).await;
// cx.assert_shared_state(indoc! {"
// 11ˇ1
// "})
// .await;
// cx.simulate_shared_keystrokes(["1", "1", "1", "ctrl-x"])
// .await;
// cx.assert_shared_state(indoc! {"
// ˇ0
// "})
// .await;
// cx.simulate_shared_keystrokes(["."]).await;
// cx.assert_shared_state(indoc! {"
// -11ˇ1
// "})
// .await;
// }
cx.simulate_shared_keystrokes(["9", "9", "ctrl-a"]).await;
cx.assert_shared_state(indoc! {"
11ˇ1
"})
.await;
cx.simulate_shared_keystrokes(["1", "1", "1", "ctrl-x"])
.await;
cx.assert_shared_state(indoc! {"
ˇ0
"})
.await;
cx.simulate_shared_keystrokes(["."]).await;
cx.assert_shared_state(indoc! {"
-11ˇ1
"})
.await;
}
// #[gpui::test]
// async fn test_increment_radix(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await;
#[gpui::test]
async fn test_increment_radix(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// cx.assert_matches_neovim("ˇ total: 0xff", ["ctrl-a"], " total: 0x10ˇ0")
// .await;
// cx.assert_matches_neovim("ˇ total: 0xff", ["ctrl-x"], " total: 0xfˇe")
// .await;
// cx.assert_matches_neovim("ˇ total: 0xFF", ["ctrl-x"], " total: 0xFˇE")
// .await;
// cx.assert_matches_neovim("(ˇ0b10f)", ["ctrl-a"], "(0b1ˇ1f)")
// .await;
// cx.assert_matches_neovim("ˇ-1", ["ctrl-a"], "ˇ0").await;
// cx.assert_matches_neovim("banˇana", ["ctrl-a"], "banˇana")
// .await;
// }
cx.assert_matches_neovim("ˇ total: 0xff", ["ctrl-a"], " total: 0x10ˇ0")
.await;
cx.assert_matches_neovim("ˇ total: 0xff", ["ctrl-x"], " total: 0xfˇe")
.await;
cx.assert_matches_neovim("ˇ total: 0xFF", ["ctrl-x"], " total: 0xFˇE")
.await;
cx.assert_matches_neovim("(ˇ0b10f)", ["ctrl-a"], "(0b1ˇ1f)")
.await;
cx.assert_matches_neovim("ˇ-1", ["ctrl-a"], "ˇ0").await;
cx.assert_matches_neovim("banˇana", ["ctrl-a"], "banˇana")
.await;
}
// #[gpui::test]
// async fn test_increment_steps(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await;
#[gpui::test]
async fn test_increment_steps(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// cx.set_shared_state(indoc! {"
// ˇ1
// 1
// 1 2
// 1
// 1"})
// .await;
cx.set_shared_state(indoc! {"
ˇ1
1
1 2
1
1"})
.await;
// cx.simulate_shared_keystrokes(["j", "v", "shift-g", "g", "ctrl-a"])
// .await;
// cx.assert_shared_state(indoc! {"
// 1
// ˇ2
// 3 2
// 4
// 5"})
// .await;
cx.simulate_shared_keystrokes(["j", "v", "shift-g", "g", "ctrl-a"])
.await;
cx.assert_shared_state(indoc! {"
1
ˇ2
3 2
4
5"})
.await;
// cx.simulate_shared_keystrokes(["shift-g", "ctrl-v", "g", "g"])
// .await;
// cx.assert_shared_state(indoc! {"
// «1ˇ»
// «2ˇ»
// «3ˇ» 2
// «4ˇ»
// «5ˇ»"})
// .await;
cx.simulate_shared_keystrokes(["shift-g", "ctrl-v", "g", "g"])
.await;
cx.assert_shared_state(indoc! {"
«1ˇ»
«2ˇ»
«3ˇ» 2
«4ˇ»
«5ˇ»"})
.await;
// cx.simulate_shared_keystrokes(["g", "ctrl-x"]).await;
// cx.assert_shared_state(indoc! {"
// ˇ0
// 0
// 0 2
// 0
// 0"})
// .await;
// }
// }
cx.simulate_shared_keystrokes(["g", "ctrl-x"]).await;
cx.assert_shared_state(indoc! {"
ˇ0
0
0 2
0
0"})
.await;
}
}