From a8c8268946f0d3aa28f29cfe3302d09fea6e0f5e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 4 Sep 2024 12:28:35 -0500 Subject: [PATCH] test(complete): Run completion tests in parallel This leaves out bash's tests because we seem to be hittin race conditions with them in CI when split. --- clap_complete/tests/testsuite/bash.rs | 14 +++++++++++++- clap_complete/tests/testsuite/elvish.rs | 16 ++++++++++++++-- clap_complete/tests/testsuite/fish.rs | 14 +++++++++++++- clap_complete/tests/testsuite/zsh.rs | 14 +++++++++++++- 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/clap_complete/tests/testsuite/bash.rs b/clap_complete/tests/testsuite/bash.rs index a90b180b..2baec1a0 100644 --- a/clap_complete/tests/testsuite/bash.rs +++ b/clap_complete/tests/testsuite/bash.rs @@ -240,7 +240,7 @@ fn register_dynamic_env() { #[test] #[cfg(all(unix, feature = "unstable-dynamic"))] -fn complete_dynamic_env() { +fn complete_dynamic_env_toplevel() { if !common::has_command("bash") { return; } @@ -257,6 +257,18 @@ fn complete_dynamic_env() { "#]]; let actual = runtime.complete(input, &term).unwrap(); assert_data_eq!(actual, expected); +} + +#[test] +#[cfg(all(unix, feature = "unstable-dynamic"))] +fn complete_dynamic_env_quoted_help() { + if !common::has_command("bash") { + return; + } + + let term = completest::Term::new(); + let mut runtime = + common::load_runtime::("dynamic-env", "exhaustive"); let input = "exhaustive quote \t\t"; let expected = snapbox::str![[r#" diff --git a/clap_complete/tests/testsuite/elvish.rs b/clap_complete/tests/testsuite/elvish.rs index 8cc49700..564a3963 100644 --- a/clap_complete/tests/testsuite/elvish.rs +++ b/clap_complete/tests/testsuite/elvish.rs @@ -142,7 +142,7 @@ fn register_completion() { #[test] #[cfg(unix)] -fn complete() { +fn complete_static_toplevel() { if !common::has_command("elvish") { return; } @@ -182,7 +182,7 @@ fn register_dynamic_env() { #[test] #[cfg(all(unix, feature = "unstable-dynamic"))] -fn complete_dynamic_env() { +fn complete_dynamic_env_toplevel() { if !common::has_command("elvish") { return; } @@ -200,6 +200,18 @@ fn complete_dynamic_env() { "#]]; let actual = runtime.complete(input, &term).unwrap(); assert_data_eq!(actual, expected); +} + +#[test] +#[cfg(all(unix, feature = "unstable-dynamic"))] +fn complete_dynamic_env_quoted_help() { + if !common::has_command("elvish") { + return; + } + + let term = completest::Term::new(); + let mut runtime = + common::load_runtime::("dynamic-env", "exhaustive"); let input = "exhaustive quote \t"; let expected = snapbox::str![[r#" diff --git a/clap_complete/tests/testsuite/fish.rs b/clap_complete/tests/testsuite/fish.rs index 04dc559d..4ea55e10 100644 --- a/clap_complete/tests/testsuite/fish.rs +++ b/clap_complete/tests/testsuite/fish.rs @@ -177,7 +177,7 @@ fn register_dynamic_env() { #[test] #[cfg(all(unix, feature = "unstable-dynamic"))] -fn complete_dynamic_env() { +fn complete_dynamic_env_toplevel() { if !common::has_command("fish") { return; } @@ -197,6 +197,18 @@ last -V (Print ve "#]]; let actual = runtime.complete(input, &term).unwrap(); assert_data_eq!(actual, expected); +} + +#[test] +#[cfg(all(unix, feature = "unstable-dynamic"))] +fn complete_dynamic_env_quoted_help() { + if !common::has_command("fish") { + return; + } + + let term = completest::Term::new(); + let mut runtime = + common::load_runtime::("dynamic-env", "exhaustive"); let input = "exhaustive quote \t\t"; let expected = snapbox::str![[r#" diff --git a/clap_complete/tests/testsuite/zsh.rs b/clap_complete/tests/testsuite/zsh.rs index 17a5e347..43273ffe 100644 --- a/clap_complete/tests/testsuite/zsh.rs +++ b/clap_complete/tests/testsuite/zsh.rs @@ -170,7 +170,7 @@ fn register_dynamic_env() { #[test] #[cfg(all(unix, feature = "unstable-dynamic"))] -fn complete_dynamic_env() { +fn complete_dynamic_env_toplevel() { if !common::has_command("zsh") { return; } @@ -187,6 +187,18 @@ fn complete_dynamic_env() { "#]]; let actual = runtime.complete(input, &term).unwrap(); assert_data_eq!(actual, expected); +} + +#[test] +#[cfg(all(unix, feature = "unstable-dynamic"))] +fn complete_dynamic_env_quoted_help() { + if !common::has_command("zsh") { + return; + } + + let term = completest::Term::new(); + let mut runtime = + common::load_runtime::("dynamic-env", "exhaustive"); let input = "exhaustive quote \t\t"; let expected = snapbox::str![[r#"