Fix panic in vim motion when not listed as exclusive and add features enum to capture why tests are ignored

This commit is contained in:
K Simmons 2022-10-24 18:27:56 -07:00
parent c295f943ba
commit 21ad375b42
34 changed files with 678 additions and 688 deletions

View file

@ -4,7 +4,7 @@ use gpui::ContextHandle;
use crate::state::Mode;
use super::NeovimBackedTestContext;
use super::{ExemptionFeatures, NeovimBackedTestContext, SUPPORTED_FEATURES};
pub struct NeovimBackedBindingTestContext<'a, const COUNT: usize> {
cx: NeovimBackedTestContext<'a>,
@ -42,6 +42,20 @@ impl<'a, const COUNT: usize> NeovimBackedBindingTestContext<'a, COUNT> {
.await
}
pub async fn assert_exempted(
&mut self,
marked_positions: &str,
feature: ExemptionFeatures,
) -> Option<(ContextHandle, ContextHandle)> {
if SUPPORTED_FEATURES.contains(&feature) {
self.cx
.assert_binding_matches(self.keystrokes_under_test, marked_positions)
.await
} else {
None
}
}
pub fn assert_manual(
&mut self,
initial_state: &str,
@ -63,6 +77,18 @@ impl<'a, const COUNT: usize> NeovimBackedBindingTestContext<'a, COUNT> {
.assert_binding_matches_all(self.keystrokes_under_test, marked_positions)
.await
}
pub async fn assert_all_exempted(
&mut self,
marked_positions: &str,
feature: ExemptionFeatures,
) {
if SUPPORTED_FEATURES.contains(&feature) {
self.cx
.assert_binding_matches_all(self.keystrokes_under_test, marked_positions)
.await
}
}
}
impl<'a, const COUNT: usize> Deref for NeovimBackedBindingTestContext<'a, COUNT> {