test(complete): Specialize tests

This commit is contained in:
Ed Page 2024-08-12 10:40:41 -05:00
parent 70d833418b
commit 6288e1169d
11 changed files with 23 additions and 18 deletions

View file

@ -250,20 +250,20 @@ fn complete() {
#[test]
#[cfg(all(unix, feature = "unstable-command"))]
fn register_dynamic_completion() {
common::register_example::<completest_pty::BashRuntimeBuilder>("dynamic", "exhaustive");
fn register_dynamic_command() {
common::register_example::<completest_pty::BashRuntimeBuilder>("dynamic-command", "exhaustive");
}
#[test]
#[cfg(all(unix, feature = "unstable-command"))]
fn complete_dynamic() {
fn complete_dynamic_command() {
if !common::has_command("bash") {
return;
}
let term = completest::Term::new();
let mut runtime =
common::load_runtime::<completest_pty::BashRuntimeBuilder>("dynamic", "exhaustive");
common::load_runtime::<completest_pty::BashRuntimeBuilder>("dynamic-command", "exhaustive");
let input = "exhaustive \t\t";
let expected = snapbox::str![[r#"

View file

@ -331,7 +331,7 @@ pub(crate) fn register_example<R: completest::RuntimeBuilder>(context: &str, nam
let mut registration = std::process::Command::new(&bin_path);
match context {
"static" => registration.args([format!("--generate={shell_name}")]),
"dynamic" => registration.args(["complete", shell_name]),
"dynamic-command" => registration.args(["complete", shell_name]),
_ => unreachable!("unsupported context {}", context),
};
let registration = registration.output().unwrap();

View file

@ -177,20 +177,25 @@ value value
#[test]
#[cfg(all(unix, feature = "unstable-command"))]
fn register_dynamic() {
common::register_example::<completest_pty::ElvishRuntimeBuilder>("dynamic", "exhaustive");
fn register_dynamic_command() {
common::register_example::<completest_pty::ElvishRuntimeBuilder>(
"dynamic-command",
"exhaustive",
);
}
#[test]
#[cfg(all(unix, feature = "unstable-command"))]
fn complete_dynamic() {
fn complete_dynamic_command() {
if !common::has_command("elvish") {
return;
}
let term = completest::Term::new();
let mut runtime =
common::load_runtime::<completest_pty::ElvishRuntimeBuilder>("dynamic", "exhaustive");
let mut runtime = common::load_runtime::<completest_pty::ElvishRuntimeBuilder>(
"dynamic-command",
"exhaustive",
);
let input = "exhaustive \t";
let expected = snapbox::str![[r#"

View file

@ -167,20 +167,20 @@ bash (bash (shell)) fish (fish shell) zsh (zsh shell)"#;
#[test]
#[cfg(all(unix, feature = "unstable-command"))]
fn register_dynamic() {
common::register_example::<completest_pty::FishRuntimeBuilder>("dynamic", "exhaustive");
fn register_dynamic_command() {
common::register_example::<completest_pty::FishRuntimeBuilder>("dynamic-command", "exhaustive");
}
#[test]
#[cfg(all(unix, feature = "unstable-command"))]
fn complete_dynamic() {
fn complete_dynamic_command() {
if !common::has_command("fish") {
return;
}
let term = completest::Term::new();
let mut runtime =
common::load_runtime::<completest_pty::FishRuntimeBuilder>("dynamic", "exhaustive");
common::load_runtime::<completest_pty::FishRuntimeBuilder>("dynamic-command", "exhaustive");
let input = "exhaustive \t\t";
let expected = snapbox::str![[r#"

View file

@ -165,20 +165,20 @@ pacman action alias value quote hint last --
#[test]
#[cfg(all(unix, feature = "unstable-command"))]
fn register_dynamic() {
common::register_example::<completest_pty::ZshRuntimeBuilder>("dynamic", "exhaustive");
fn register_dynamic_command() {
common::register_example::<completest_pty::ZshRuntimeBuilder>("dynamic-command", "exhaustive");
}
#[test]
#[cfg(all(unix, feature = "unstable-command"))]
fn complete_dynamic() {
fn complete_dynamic_command() {
if !common::has_command("zsh") {
return;
}
let term = completest::Term::new();
let mut runtime =
common::load_runtime::<completest_pty::ZshRuntimeBuilder>("dynamic", "exhaustive");
common::load_runtime::<completest_pty::ZshRuntimeBuilder>("dynamic-command", "exhaustive");
let input = "exhaustive \t\t";
let expected = snapbox::str![[r#"