mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
test(complete): Use more snapshotting
This commit is contained in:
parent
32ed967a0a
commit
d51922c79e
2 changed files with 13 additions and 7 deletions
|
@ -171,15 +171,17 @@ fn complete() {
|
|||
common::load_runtime::<completest_pty::BashRuntimeBuilder>("static", "exhaustive");
|
||||
|
||||
let input = "exhaustive \t\t";
|
||||
let expected = r#"%
|
||||
let expected = snapbox::str![[r#"
|
||||
%
|
||||
-h --global --help action value last hint help
|
||||
-V --generate --version quote pacman alias complete "#;
|
||||
-V --generate --version quote pacman alias complete
|
||||
"#]];
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
assert_data_eq!(actual, expected);
|
||||
|
||||
// Issue 5239 (https://github.com/clap-rs/clap/issues/5239)
|
||||
let input = "exhaustive hint --file test\t";
|
||||
let expected = "exhaustive hint --file test % exhaustive hint --file tests/";
|
||||
let expected = snapbox::str!["exhaustive hint --file test % exhaustive hint --file tests/"];
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
assert_data_eq!(actual, expected);
|
||||
|
||||
|
|
|
@ -152,16 +152,20 @@ fn complete() {
|
|||
common::load_runtime::<completest_pty::FishRuntimeBuilder>("static", "exhaustive");
|
||||
|
||||
let input = "exhaustive \t";
|
||||
let expected = r#"% exhaustive
|
||||
let expected = snapbox::str![[r#"
|
||||
% exhaustive
|
||||
action complete (Register shell completions for this program) hint pacman value
|
||||
alias help (Print this message or the help of the given subcommand(s)) last quote "#;
|
||||
alias help (Print this message or the help of the given subcommand(s)) last quote
|
||||
"#]];
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
assert_data_eq!(actual, expected);
|
||||
|
||||
let input = "exhaustive quote --choice \t";
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
let expected = r#"% exhaustive quote --choice
|
||||
bash (bash (shell)) fish (fish shell) zsh (zsh shell)"#;
|
||||
let expected = snapbox::str![[r#"
|
||||
% exhaustive quote --choice
|
||||
bash (bash (shell)) fish (fish shell) zsh (zsh shell)
|
||||
"#]];
|
||||
assert_data_eq!(actual, expected);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue