Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove supported exception
Conrad Irwindcaba9d9e7d9
diff --git a/crates/vim/src/normal/change.rs b/crates/vim/src/normal/change.rsindex 836ce1492b6..e9f3001392c 100644--- a/crates/vim/src/normal/change.rs+++ b/crates/vim/src/normal/change.rs@@ -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 quickbrown ˇfox- jumps over"})- .await;- cx.assert(indoc! {"+ jumps over"},+ ["c", "k"],+ )+ .await;+ cx.assert_neovim_compatible(+ indoc! {"The quickbrown fox- jumps ˇover"})- .await;- cx.assert_exempted(+ jumps ˇover"},+ ["c", "k"],+ )+ .await;+ cx.assert_neovim_compatible(indoc! {"The qˇuickbrown foxjumps over"},- ExemptionFeatures::OperatorAbortsOnFailedMotion,+ ["c", "k"],).await;- cx.assert_exempted(+ cx.assert_neovim_compatible(indoc! {"ˇbrown foxjumps 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 quickbrown ˇfox- jumps over"})- .await;- cx.assert_exempted(+ jumps over"},+ ["c", "j"],+ )+ .await;+ cx.assert_neovim_compatible(indoc! {"The quickbrown foxjumps ˇover"},- ExemptionFeatures::OperatorAbortsOnFailedMotion,+ ["c", "j"],).await;- cx.assert(indoc! {"+ cx.assert_neovim_compatible(+ indoc! {"The qˇuickbrown fox- jumps over"})- .await;- cx.assert_exempted(+ jumps over"},+ ["c", "j"],+ )+ .await;+ cx.assert_neovim_compatible(indoc! {"The quickbrown 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 quickbrownˇ foxjumps over- the lazy"})- .await;- cx.assert(indoc! {"+ the lazy"},+ ["c", "shift-g"],+ )+ .await;+ cx.assert_neovim_compatible(+ indoc! {"The quickbrownˇ foxjumps over- the lazy"})- .await;- cx.assert_exempted(+ the lazy"},+ ["c", "shift-g"],+ )+ .await;+ cx.assert_neovim_compatible(indoc! {"The quickbrown foxjumps overthe lˇazy"},- ExemptionFeatures::OperatorAbortsOnFailedMotion,+ ["c", "shift-g"],).await;- cx.assert_exempted(+ cx.assert_neovim_compatible(indoc! {"The quickbrown foxjumps 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 quickbrownˇ foxjumps over- the lazy"})- .await;- cx.assert(indoc! {"+ the lazy"},+ ["c", "g", "g"],+ )+ .await;+ cx.assert_neovim_compatible(+ indoc! {"The quickbrown foxjumps over- the lˇazy"})- .await;- cx.assert_exempted(+ the lˇazy"},+ ["c", "g", "g"],+ )+ .await;+ cx.assert_neovim_compatible(indoc! {"The qˇuickbrown foxjumps overthe lazy"},- ExemptionFeatures::OperatorAbortsOnFailedMotion,+ ["c", "g", "g"],).await;- cx.assert_exempted(+ cx.assert_neovim_compatible(indoc! {"ˇbrown foxjumps overthe 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;+ }}}diff --git a/crates/vim/src/normal/delete.rs b/crates/vim/src/normal/delete.rsindex 1126eb11551..19ea6af875f 100644--- a/crates/vim/src/normal/delete.rs+++ b/crates/vim/src/normal/delete.rs@@ -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 quickbrownˇ foxjumps over- the lazy"})- .await;- cx.assert(indoc! {"+ the lazy"},+ ["d", "shift-g"],+ )+ .await;+ cx.assert_neovim_compatible(+ indoc! {"The quickbrownˇ foxjumps over- the lazy"})- .await;- cx.assert_exempted(+ the lazy"},+ ["d", "shift-g"],+ )+ .await;+ cx.assert_neovim_compatible(indoc! {"The quickbrown foxjumps overthe lˇazy"},- ExemptionFeatures::OperatorAbortsOnFailedMotion,+ ["d", "shift-g"],).await;- cx.assert_exempted(+ cx.assert_neovim_compatible(indoc! {"The quickbrown foxjumps 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 quickbrownˇ foxjumps over- the lazy"})+ the lazy"}, ["d", "g", "g"]).await;- cx.assert(indoc! {"+ cx.assert_neovim_compatible(indoc! {"The quickbrown foxjumps over- the lˇazy"})+ the lˇazy"}, ["d", "g", "g"]).await;- cx.assert_exempted(+ cx.assert_neovim_compatible(indoc! {"The qˇuickbrown foxjumps over- the lazy"},- ExemptionFeatures::OperatorAbortsOnFailedMotion,+ the lazy"},["d", "g", "g"]).await;- cx.assert_exempted(+ cx.assert_neovim_compatible(indoc! {"ˇbrown foxjumps over- the lazy"},- ExemptionFeatures::OperatorAbortsOnFailedMotion,+ the lazy"},["d", "g", "g"]).await;}diff --git a/crates/vim/src/test/neovim_backed_test_context.rs b/crates/vim/src/test/neovim_backed_test_context.rsindex 97df989e4d5..0df5c32136b 100644--- a/crates/vim/src/test/neovim_backed_test_context.rs+++ b/crates/vim/src/test/neovim_backed_test_context.rs@@ -13,10 +13,7 @@ use util::test::{generate_marked_text, marked_text_offsets};use super::{neovim_connection::NeovimConnection, NeovimBackedBindingTestContext, VimTestContext};use crate::state::Mode;-pub const SUPPORTED_FEATURES: &[ExemptionFeatures] = &[- ExemptionFeatures::DeletionOnEmptyLine,- ExemptionFeatures::OperatorAbortsOnFailedMotion,-];+pub const SUPPORTED_FEATURES: &[ExemptionFeatures] = &[ExemptionFeatures::DeletionOnEmptyLine];/// Enum representing features we have tests for but which don't work, yet. Used/// to add exemptions and automatically@@ -25,8 +22,6 @@ pub enum ExemptionFeatures {// MOTIONS// Deletions on empty lines miss some newlinesDeletionOnEmptyLine,- // When a motion fails, it should should not apply linewise operations- OperatorAbortsOnFailedMotion,// When an operator completes at the end of the file, an extra newline is leftOperatorLastNewlineRemains,// Deleting a word on an empty line doesn't remove the newline@@ -389,6 +384,9 @@ impl<'a> DerefMut for NeovimBackedTestContext<'a> {}}+// a common mistake in tests is to call set_shared_state when+// you mean asswert_shared_state. This notices that and lets+// you know.impl<'a> Drop for NeovimBackedTestContext<'a> {fn drop(&mut self) {if self.is_dirty {