Remove supported exception
(and refactor tests to be more linear)
This commit is contained in:
parent
7daed1b2c3
commit
dcaba9d9e7
3 changed files with 123 additions and 105 deletions
|
@ -121,7 +121,7 @@ fn expand_changed_word_selection(
|
|||
mod test {
|
||||
use indoc::indoc;
|
||||
|
||||
use crate::test::{ExemptionFeatures, NeovimBackedTestContext};
|
||||
use crate::test::NeovimBackedTestContext;
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_change_h(cx: &mut gpui::TestAppContext) {
|
||||
|
@ -239,150 +239,178 @@ mod test {
|
|||
|
||||
#[gpui::test]
|
||||
async fn test_change_0(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "0"]);
|
||||
cx.assert(indoc! {"
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The qˇuick
|
||||
brown fox"})
|
||||
.await;
|
||||
cx.assert(indoc! {"
|
||||
brown fox"},
|
||||
["c", "0"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
ˇ
|
||||
brown fox"})
|
||||
.await;
|
||||
brown fox"},
|
||||
["c", "0"],
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_change_k(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "k"]);
|
||||
cx.assert(indoc! {"
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown ˇfox
|
||||
jumps over"})
|
||||
.await;
|
||||
cx.assert(indoc! {"
|
||||
jumps over"},
|
||||
["c", "k"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
jumps ˇover"})
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
jumps ˇover"},
|
||||
["c", "k"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The qˇuick
|
||||
brown fox
|
||||
jumps over"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["c", "k"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
ˇ
|
||||
brown fox
|
||||
jumps over"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["c", "k"],
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_change_j(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "j"]);
|
||||
cx.assert(indoc! {"
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown ˇfox
|
||||
jumps over"})
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
jumps over"},
|
||||
["c", "j"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
jumps ˇover"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["c", "j"],
|
||||
)
|
||||
.await;
|
||||
cx.assert(indoc! {"
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The qˇuick
|
||||
brown fox
|
||||
jumps over"})
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
jumps over"},
|
||||
["c", "j"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
ˇ"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["c", "j"],
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_change_end_of_document(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx)
|
||||
.await
|
||||
.binding(["c", "shift-g"]);
|
||||
cx.assert(indoc! {"
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brownˇ fox
|
||||
jumps over
|
||||
the lazy"})
|
||||
.await;
|
||||
cx.assert(indoc! {"
|
||||
the lazy"},
|
||||
["c", "shift-g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brownˇ fox
|
||||
jumps over
|
||||
the lazy"})
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
the lazy"},
|
||||
["c", "shift-g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
jumps over
|
||||
the lˇazy"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["c", "shift-g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
jumps over
|
||||
ˇ"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["c", "shift-g"],
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_change_gg(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx)
|
||||
.await
|
||||
.binding(["c", "g", "g"]);
|
||||
cx.assert(indoc! {"
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brownˇ fox
|
||||
jumps over
|
||||
the lazy"})
|
||||
.await;
|
||||
cx.assert(indoc! {"
|
||||
the lazy"},
|
||||
["c", "g", "g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
jumps over
|
||||
the lˇazy"})
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
the lˇazy"},
|
||||
["c", "g", "g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The qˇuick
|
||||
brown fox
|
||||
jumps over
|
||||
the lazy"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["c", "g", "g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
ˇ
|
||||
brown fox
|
||||
jumps over
|
||||
the lazy"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["c", "g", "g"],
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
@ -427,27 +455,17 @@ mod test {
|
|||
async fn test_repeated_cb(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.add_initial_state_exemptions(
|
||||
indoc! {"
|
||||
ˇThe quick brown
|
||||
|
||||
fox jumps-over
|
||||
the lazy dog
|
||||
"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
);
|
||||
|
||||
for count in 1..=5 {
|
||||
cx.assert_binding_matches_all(
|
||||
["c", &count.to_string(), "b"],
|
||||
indoc! {"
|
||||
ˇThe quˇickˇ browˇn
|
||||
ˇ
|
||||
ˇfox ˇjumpsˇ-ˇoˇver
|
||||
ˇthe lazy dog
|
||||
"},
|
||||
)
|
||||
.await;
|
||||
for marked_text in cx.each_marked_position(indoc! {"
|
||||
ˇThe quˇickˇ browˇn
|
||||
ˇ
|
||||
ˇfox ˇjumpsˇ-ˇoˇver
|
||||
ˇthe lazy dog
|
||||
"})
|
||||
{
|
||||
cx.assert_neovim_compatible(&marked_text, ["c", &count.to_string(), "b"])
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -278,37 +278,41 @@ mod test {
|
|||
|
||||
#[gpui::test]
|
||||
async fn test_delete_end_of_document(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx)
|
||||
.await
|
||||
.binding(["d", "shift-g"]);
|
||||
cx.assert(indoc! {"
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brownˇ fox
|
||||
jumps over
|
||||
the lazy"})
|
||||
.await;
|
||||
cx.assert(indoc! {"
|
||||
the lazy"},
|
||||
["d", "shift-g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brownˇ fox
|
||||
jumps over
|
||||
the lazy"})
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
the lazy"},
|
||||
["d", "shift-g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
jumps over
|
||||
the lˇazy"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["d", "shift-g"],
|
||||
)
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
jumps over
|
||||
ˇ"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
["d", "shift-g"],
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
@ -318,34 +322,32 @@ mod test {
|
|||
let mut cx = NeovimBackedTestContext::new(cx)
|
||||
.await
|
||||
.binding(["d", "g", "g"]);
|
||||
cx.assert(indoc! {"
|
||||
cx.assert_neovim_compatible(indoc! {"
|
||||
The quick
|
||||
brownˇ fox
|
||||
jumps over
|
||||
the lazy"})
|
||||
the lazy"}, ["d", "g", "g"])
|
||||
.await;
|
||||
cx.assert(indoc! {"
|
||||
cx.assert_neovim_compatible(indoc! {"
|
||||
The quick
|
||||
brown fox
|
||||
jumps over
|
||||
the lˇazy"})
|
||||
the lˇazy"}, ["d", "g", "g"])
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
The qˇuick
|
||||
brown fox
|
||||
jumps over
|
||||
the lazy"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
the lazy"},["d", "g", "g"]
|
||||
)
|
||||
.await;
|
||||
cx.assert_exempted(
|
||||
cx.assert_neovim_compatible(
|
||||
indoc! {"
|
||||
ˇ
|
||||
brown fox
|
||||
jumps over
|
||||
the lazy"},
|
||||
ExemptionFeatures::OperatorAbortsOnFailedMotion,
|
||||
the lazy"},["d", "g", "g"]
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue