Flesh out v1.0 of vim :

This commit is contained in:
Conrad Irwin 2023-09-20 15:24:31 -06:00
parent 6ad1f19a21
commit 2d9db0fed1
16 changed files with 516 additions and 82 deletions

View file

@ -106,26 +106,25 @@ impl<'a> NeovimBackedTestContext<'a> {
pub async fn simulate_shared_keystrokes<const COUNT: usize>(
&mut self,
keystroke_texts: [&str; COUNT],
) -> ContextHandle {
) {
for keystroke_text in keystroke_texts.into_iter() {
self.recent_keystrokes.push(keystroke_text.to_string());
self.neovim.send_keystroke(keystroke_text).await;
}
self.simulate_keystrokes(keystroke_texts)
self.simulate_keystrokes(keystroke_texts);
}
pub async fn set_shared_state(&mut self, marked_text: &str) -> ContextHandle {
pub async fn set_shared_state(&mut self, marked_text: &str) {
let mode = if marked_text.contains("»") {
Mode::Visual
} else {
Mode::Normal
};
let context_handle = self.set_state(marked_text, mode);
self.set_state(marked_text, mode);
self.last_set_state = Some(marked_text.to_string());
self.recent_keystrokes = Vec::new();
self.neovim.set_state(marked_text).await;
self.is_dirty = true;
context_handle
}
pub async fn set_shared_wrap(&mut self, columns: u32) {
@ -288,18 +287,18 @@ impl<'a> NeovimBackedTestContext<'a> {
&mut self,
keystrokes: [&str; COUNT],
initial_state: &str,
) -> Option<(ContextHandle, ContextHandle)> {
) {
if let Some(possible_exempted_keystrokes) = self.exemptions.get(initial_state) {
match possible_exempted_keystrokes {
Some(exempted_keystrokes) => {
if exempted_keystrokes.contains(&format!("{keystrokes:?}")) {
// This keystroke was exempted for this insertion text
return None;
return;
}
}
None => {
// All keystrokes for this insertion text are exempted
return None;
return;
}
}
}
@ -307,7 +306,6 @@ impl<'a> NeovimBackedTestContext<'a> {
let _state_context = self.set_shared_state(initial_state).await;
let _keystroke_context = self.simulate_shared_keystrokes(keystrokes).await;
self.assert_state_matches().await;
Some((_state_context, _keystroke_context))
}
pub async fn assert_binding_matches_all<const COUNT: usize>(