Skip to content

Commit

Permalink
Merge pull request #5718 from epage/test-split
Browse files Browse the repository at this point in the history
test(complete): Run completion tests in parallel
  • Loading branch information
epage committed Sep 4, 2024
2 parents c493c85 + a8c8268 commit 31a4450
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 5 deletions.
14 changes: 13 additions & 1 deletion clap_complete/tests/testsuite/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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::<completest_pty::BashRuntimeBuilder>("dynamic-env", "exhaustive");

let input = "exhaustive quote \t\t";
let expected = snapbox::str![[r#"
Expand Down
16 changes: 14 additions & 2 deletions clap_complete/tests/testsuite/elvish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn register_completion() {

#[test]
#[cfg(unix)]
fn complete() {
fn complete_static_toplevel() {
if !common::has_command("elvish") {
return;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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::<completest_pty::ElvishRuntimeBuilder>("dynamic-env", "exhaustive");

let input = "exhaustive quote \t";
let expected = snapbox::str![[r#"
Expand Down
14 changes: 13 additions & 1 deletion clap_complete/tests/testsuite/fish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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::<completest_pty::FishRuntimeBuilder>("dynamic-env", "exhaustive");

let input = "exhaustive quote \t\t";
let expected = snapbox::str![[r#"
Expand Down
14 changes: 13 additions & 1 deletion clap_complete/tests/testsuite/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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::<completest_pty::ZshRuntimeBuilder>("dynamic-env", "exhaustive");

let input = "exhaustive quote \t\t";
let expected = snapbox::str![[r#"
Expand Down

0 comments on commit 31a4450

Please sign in to comment.