aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests/integration/helpers.rs
diff options
context:
space:
mode:
authorSkyler Hawthorne2022-05-01 00:47:53 +0000
committerSkyler Hawthorne2022-06-19 03:54:03 +0000
commit40120967e9ba48d2e8b5fb4976a6ca1ce8993704 (patch)
tree784f59fed20a32e3e2d0417a16f9c7b7f9db2889 /helix-term/tests/integration/helpers.rs
parent07fc80aece221233b4a986b0c5a03e2056cc1307 (diff)
tests for buffer-close
Diffstat (limited to 'helix-term/tests/integration/helpers.rs')
-rw-r--r--helix-term/tests/integration/helpers.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/helix-term/tests/integration/helpers.rs b/helix-term/tests/integration/helpers.rs
index 60bfa331..18a3517c 100644
--- a/helix-term/tests/integration/helpers.rs
+++ b/helix-term/tests/integration/helpers.rs
@@ -34,7 +34,7 @@ impl<S: Into<String>> From<(S, S, S)> for TestCase {
#[inline]
pub async fn test_key_sequence(
app: &mut Application,
- in_keys: &str,
+ in_keys: Option<&str>,
test_fn: Option<&dyn Fn(&Application)>,
timeout: Option<Duration>,
) -> anyhow::Result<()> {
@@ -43,7 +43,7 @@ pub async fn test_key_sequence(
pub async fn test_key_sequences(
app: &mut Application,
- inputs: Vec<(&str, Option<&dyn Fn(&Application)>)>,
+ inputs: Vec<(Option<&str>, Option<&dyn Fn(&Application)>)>,
timeout: Option<Duration>,
) -> anyhow::Result<()> {
let timeout = timeout.unwrap_or(Duration::from_millis(500));
@@ -51,8 +51,10 @@ pub async fn test_key_sequences(
let mut rx_stream = UnboundedReceiverStream::new(rx);
for (in_keys, test_fn) in inputs {
- for key_event in parse_macro(&in_keys)?.into_iter() {
- tx.send(Ok(Event::Key(KeyEvent::from(key_event))))?;
+ if let Some(in_keys) = in_keys {
+ for key_event in parse_macro(&in_keys)?.into_iter() {
+ tx.send(Ok(Event::Key(KeyEvent::from(key_event))))?;
+ }
}
let event_loop = app.event_loop(&mut rx_stream);
@@ -100,7 +102,7 @@ pub async fn test_key_sequence_with_input_text<T: Into<TestCase>>(
view.id,
);
- test_key_sequence(&mut app, &test_case.in_keys, Some(test_fn), timeout).await
+ test_key_sequence(&mut app, Some(&test_case.in_keys), Some(test_fn), timeout).await
}
/// Use this for very simple test cases where there is one input