From 6288e1169db0f161361424e574fe22bcbdd2ddeb Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 12 Aug 2024 10:40:41 -0500 Subject: [PATCH] test(complete): Specialize tests --- .../exhaustive/bash/.bashrc | 0 .../exhaustive/elvish/elvish/rc.elv | 0 .../fish/fish/completions/exhaustive.fish | 0 .../exhaustive/fish/fish/config.fish | 0 .../exhaustive/zsh/.zshenv | 0 .../exhaustive/zsh/zsh/_exhaustive | 0 clap_complete/tests/testsuite/bash.rs | 8 ++++---- clap_complete/tests/testsuite/common.rs | 2 +- clap_complete/tests/testsuite/elvish.rs | 15 ++++++++++----- clap_complete/tests/testsuite/fish.rs | 8 ++++---- clap_complete/tests/testsuite/zsh.rs | 8 ++++---- 11 files changed, 23 insertions(+), 18 deletions(-) rename clap_complete/tests/snapshots/home/{dynamic => dynamic-command}/exhaustive/bash/.bashrc (100%) rename clap_complete/tests/snapshots/home/{dynamic => dynamic-command}/exhaustive/elvish/elvish/rc.elv (100%) rename clap_complete/tests/snapshots/home/{dynamic => dynamic-command}/exhaustive/fish/fish/completions/exhaustive.fish (100%) rename clap_complete/tests/snapshots/home/{dynamic => dynamic-command}/exhaustive/fish/fish/config.fish (100%) rename clap_complete/tests/snapshots/home/{dynamic => dynamic-command}/exhaustive/zsh/.zshenv (100%) rename clap_complete/tests/snapshots/home/{dynamic => dynamic-command}/exhaustive/zsh/zsh/_exhaustive (100%) diff --git a/clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc b/clap_complete/tests/snapshots/home/dynamic-command/exhaustive/bash/.bashrc similarity index 100% rename from clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc rename to clap_complete/tests/snapshots/home/dynamic-command/exhaustive/bash/.bashrc diff --git a/clap_complete/tests/snapshots/home/dynamic/exhaustive/elvish/elvish/rc.elv b/clap_complete/tests/snapshots/home/dynamic-command/exhaustive/elvish/elvish/rc.elv similarity index 100% rename from clap_complete/tests/snapshots/home/dynamic/exhaustive/elvish/elvish/rc.elv rename to clap_complete/tests/snapshots/home/dynamic-command/exhaustive/elvish/elvish/rc.elv diff --git a/clap_complete/tests/snapshots/home/dynamic/exhaustive/fish/fish/completions/exhaustive.fish b/clap_complete/tests/snapshots/home/dynamic-command/exhaustive/fish/fish/completions/exhaustive.fish similarity index 100% rename from clap_complete/tests/snapshots/home/dynamic/exhaustive/fish/fish/completions/exhaustive.fish rename to clap_complete/tests/snapshots/home/dynamic-command/exhaustive/fish/fish/completions/exhaustive.fish diff --git a/clap_complete/tests/snapshots/home/dynamic/exhaustive/fish/fish/config.fish b/clap_complete/tests/snapshots/home/dynamic-command/exhaustive/fish/fish/config.fish similarity index 100% rename from clap_complete/tests/snapshots/home/dynamic/exhaustive/fish/fish/config.fish rename to clap_complete/tests/snapshots/home/dynamic-command/exhaustive/fish/fish/config.fish diff --git a/clap_complete/tests/snapshots/home/dynamic/exhaustive/zsh/.zshenv b/clap_complete/tests/snapshots/home/dynamic-command/exhaustive/zsh/.zshenv similarity index 100% rename from clap_complete/tests/snapshots/home/dynamic/exhaustive/zsh/.zshenv rename to clap_complete/tests/snapshots/home/dynamic-command/exhaustive/zsh/.zshenv diff --git a/clap_complete/tests/snapshots/home/dynamic/exhaustive/zsh/zsh/_exhaustive b/clap_complete/tests/snapshots/home/dynamic-command/exhaustive/zsh/zsh/_exhaustive similarity index 100% rename from clap_complete/tests/snapshots/home/dynamic/exhaustive/zsh/zsh/_exhaustive rename to clap_complete/tests/snapshots/home/dynamic-command/exhaustive/zsh/zsh/_exhaustive diff --git a/clap_complete/tests/testsuite/bash.rs b/clap_complete/tests/testsuite/bash.rs index d39debbc4cb..16594dfa348 100644 --- a/clap_complete/tests/testsuite/bash.rs +++ b/clap_complete/tests/testsuite/bash.rs @@ -250,20 +250,20 @@ fn complete() { #[test] #[cfg(all(unix, feature = "unstable-command"))] -fn register_dynamic_completion() { - common::register_example::("dynamic", "exhaustive"); +fn register_dynamic_command() { + common::register_example::("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::("dynamic", "exhaustive"); + common::load_runtime::("dynamic-command", "exhaustive"); let input = "exhaustive \t\t"; let expected = snapbox::str![[r#" diff --git a/clap_complete/tests/testsuite/common.rs b/clap_complete/tests/testsuite/common.rs index 7ebfea6837a..b495d919a01 100644 --- a/clap_complete/tests/testsuite/common.rs +++ b/clap_complete/tests/testsuite/common.rs @@ -331,7 +331,7 @@ pub(crate) fn register_example(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(); diff --git a/clap_complete/tests/testsuite/elvish.rs b/clap_complete/tests/testsuite/elvish.rs index b953fd8bcfa..4b1e877acdb 100644 --- a/clap_complete/tests/testsuite/elvish.rs +++ b/clap_complete/tests/testsuite/elvish.rs @@ -177,20 +177,25 @@ value value #[test] #[cfg(all(unix, feature = "unstable-command"))] -fn register_dynamic() { - common::register_example::("dynamic", "exhaustive"); +fn register_dynamic_command() { + common::register_example::( + "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::("dynamic", "exhaustive"); + let mut runtime = common::load_runtime::( + "dynamic-command", + "exhaustive", + ); let input = "exhaustive \t"; let expected = snapbox::str![[r#" diff --git a/clap_complete/tests/testsuite/fish.rs b/clap_complete/tests/testsuite/fish.rs index a4eaddab126..705b2d4922a 100644 --- a/clap_complete/tests/testsuite/fish.rs +++ b/clap_complete/tests/testsuite/fish.rs @@ -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::("dynamic", "exhaustive"); +fn register_dynamic_command() { + common::register_example::("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::("dynamic", "exhaustive"); + common::load_runtime::("dynamic-command", "exhaustive"); let input = "exhaustive \t\t"; let expected = snapbox::str![[r#" diff --git a/clap_complete/tests/testsuite/zsh.rs b/clap_complete/tests/testsuite/zsh.rs index d0b2f503ef0..3a3fa2cf080 100644 --- a/clap_complete/tests/testsuite/zsh.rs +++ b/clap_complete/tests/testsuite/zsh.rs @@ -165,20 +165,20 @@ pacman action alias value quote hint last -- #[test] #[cfg(all(unix, feature = "unstable-command"))] -fn register_dynamic() { - common::register_example::("dynamic", "exhaustive"); +fn register_dynamic_command() { + common::register_example::("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::("dynamic", "exhaustive"); + common::load_runtime::("dynamic-command", "exhaustive"); let input = "exhaustive \t\t"; let expected = snapbox::str![[r#"