@@ -9,7 +9,7 @@ use anyhow::bail;
9use crossterm::event::{Event, KeyEvent};
9use crossterm::event::{Event, KeyEvent};
10use helix_core::{diagnostic::Severity, test, Selection, Transaction};
10use helix_core::{diagnostic::Severity, test, Selection, Transaction};
11use helix_term::{application::Application, args::Args, config::Config, keymap::merge_keys};
11use helix_term::{application::Application, args::Args, config::Config, keymap::merge_keys};
12−use helix_view::{doc, editor::LspConfig, input::parse_macro, Editor};
12+use helix_view::{current_ref, doc, editor::LspConfig, input::parse_macro, Editor};
13use tempfile::NamedTempFile;
13use tempfile::NamedTempFile;
14use tokio_stream::wrappers::UnboundedReceiverStream;
14use tokio_stream::wrappers::UnboundedReceiverStream;
@@ -64,6 +64,11 @@ pub async fn test_key_sequences(
64 let num_inputs = inputs.len();
64 let num_inputs = inputs.len();
66 for (i, (in_keys, test_fn)) in inputs.into_iter().enumerate() {
66 for (i, (in_keys, test_fn)) in inputs.into_iter().enumerate() {
67+ let (view, doc) = current_ref!(app.editor);
68+ let state = test::plain(&doc.text().to_string(), doc.selection(view.id));
70+ log::debug!("executing test with document state:\n\n-----\n\n{}", state);
67 if let Some(in_keys) = in_keys {
72 if let Some(in_keys) = in_keys {
68 for key_event in parse_macro(in_keys)?.into_iter() {
73 for key_event in parse_macro(in_keys)?.into_iter() {
69 let key = Event::Key(KeyEvent::from(key_event));
74 let key = Event::Key(KeyEvent::from(key_event));
@@ -74,6 +79,16 @@ pub async fn test_key_sequences(
75 let app_exited = !app.event_loop_until_idle(&mut rx_stream).await;
80 let app_exited = !app.event_loop_until_idle(&mut rx_stream).await;
83+ let (view, doc) = current_ref!(app.editor);
84+ let state = test::plain(&doc.text().to_string(), doc.selection(view.id));
87+ "finished running test with document state:\n\n-----\n\n{}",
77 // the app should not exit from any test until the last one
92 // the app should not exit from any test until the last one
78 if i < num_inputs - 1 && app_exited {
93 if i < num_inputs - 1 && app_exited {
79 bail!("application exited before test function could run");
94 bail!("application exited before test function could run");