mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
test(complete): Normalize snapshot format
This commit is contained in:
parent
e3188215ca
commit
8cb0e7fdaf
3 changed files with 184 additions and 286 deletions
|
@ -25,14 +25,11 @@ fn suggest_subcommand_subset() {
|
|||
.subcommand(Command::new("hello-moon"))
|
||||
.subcommand(Command::new("goodbye-world"));
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "he"),
|
||||
snapbox::str![[r#"
|
||||
assert_data_eq!(complete!(cmd, "he"), snapbox::str![[r#"
|
||||
hello-moon
|
||||
hello-world
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
"#]],
|
||||
);
|
||||
"#]],);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -45,15 +42,9 @@ fn suggest_hidden_long_flags() {
|
|||
.hide(true),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--hello-world"),
|
||||
snapbox::str!["--hello-world-visible"]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "--hello-world"), snapbox::str!["--hello-world-visible"]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--hello-world-h"),
|
||||
snapbox::str!["--hello-world-hidden"]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "--hello-world-h"), snapbox::str!["--hello-world-hidden"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -71,27 +62,18 @@ fn suggest_hidden_subcommand_and_aliases() {
|
|||
.hide(true),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "test"),
|
||||
snapbox::str![
|
||||
"test_visible
|
||||
test_visible-alias_visible"
|
||||
]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "test"), snapbox::str![[r#"
|
||||
test_visible
|
||||
test_visible-alias_visible
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "test_h"),
|
||||
snapbox::str![
|
||||
"test_hidden
|
||||
assert_data_eq!(complete!(cmd, "test_h"), snapbox::str![[r#"
|
||||
test_hidden
|
||||
test_hidden-alias_hidden
|
||||
test_hidden-alias_visible"
|
||||
]
|
||||
);
|
||||
test_hidden-alias_visible
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "test_hidden-alias_h"),
|
||||
snapbox::str!["test_hidden-alias_hidden"]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "test_hidden-alias_h"), snapbox::str!["test_hidden-alias_hidden"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -113,15 +95,12 @@ fn suggest_subcommand_aliases() {
|
|||
.alias("hidden-goodbye"),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "hello"),
|
||||
snapbox::str![
|
||||
"hello-moon
|
||||
assert_data_eq!(complete!(cmd, "hello"), snapbox::str![[r#"
|
||||
hello-moon
|
||||
hello-moon-foo
|
||||
hello-world
|
||||
hello-world-foo"
|
||||
],
|
||||
);
|
||||
hello-world-foo
|
||||
"#]],);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -135,15 +114,9 @@ fn suggest_hidden_possible_value() {
|
|||
]),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--test=test"),
|
||||
snapbox::str!["--test=test-visible\tSay hello to the world"]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "--test=test"), snapbox::str!["--test=test-visible Say hello to the world"]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--test=test-h"),
|
||||
snapbox::str!["--test=test-hidden\tSay hello to the moon"]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "--test=test-h"), snapbox::str!["--test=test-hidden Say hello to the moon"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -163,32 +136,20 @@ fn suggest_hidden_long_flag_aliases() {
|
|||
.hide(true),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--test"),
|
||||
snapbox::str![
|
||||
"--test_visible
|
||||
--test_visible-alias_visible"
|
||||
]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "--test"), snapbox::str![[r#"
|
||||
--test_visible
|
||||
--test_visible-alias_visible
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--test_h"),
|
||||
snapbox::str![
|
||||
"--test_hidden
|
||||
assert_data_eq!(complete!(cmd, "--test_h"), snapbox::str![[r#"
|
||||
--test_hidden
|
||||
--test_hidden-alias_visible
|
||||
--test_hidden-alias_hidden"
|
||||
]
|
||||
);
|
||||
--test_hidden-alias_hidden
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--test_visible-alias_h"),
|
||||
snapbox::str!["--test_visible-alias_hidden"]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "--test_visible-alias_h"), snapbox::str!["--test_visible-alias_hidden"]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--test_hidden-alias_h"),
|
||||
snapbox::str!["--test_hidden-alias_hidden"]
|
||||
);
|
||||
assert_data_eq!(complete!(cmd, "--test_hidden-alias_h"), snapbox::str!["--test_hidden-alias_hidden"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -210,14 +171,11 @@ fn suggest_long_flag_subset() {
|
|||
.action(clap::ArgAction::Count),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--he"),
|
||||
snapbox::str![[r#"
|
||||
assert_data_eq!(complete!(cmd, "--he"), snapbox::str![[r#"
|
||||
--hello-world
|
||||
--hello-moon
|
||||
--help Print help
|
||||
"#]],
|
||||
);
|
||||
"#]],);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -229,13 +187,10 @@ fn suggest_possible_value_subset() {
|
|||
"goodbye-world".into(),
|
||||
]));
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "hello"),
|
||||
snapbox::str![[r#"
|
||||
assert_data_eq!(complete!(cmd, "hello"), snapbox::str![[r#"
|
||||
hello-world Say hello to the world
|
||||
hello-moon
|
||||
"#]],
|
||||
);
|
||||
"#]],);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -257,15 +212,12 @@ fn suggest_additional_short_flags() {
|
|||
.action(clap::ArgAction::Count),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-a"),
|
||||
snapbox::str![[r#"
|
||||
assert_data_eq!(complete!(cmd, "-a"), snapbox::str![[r#"
|
||||
-aa
|
||||
-ab
|
||||
-ac
|
||||
-ah Print help
|
||||
"#]],
|
||||
);
|
||||
"#]],);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -278,16 +230,13 @@ fn suggest_subcommand_positional() {
|
|||
]),
|
||||
));
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "hello-world [TAB]"),
|
||||
snapbox::str![[r#"
|
||||
assert_data_eq!(complete!(cmd, "hello-world [TAB]"), snapbox::str![[r#"
|
||||
--help Print help (see more with '--help')
|
||||
-h Print help (see more with '--help')
|
||||
hello-world Say hello to the world
|
||||
hello-moon
|
||||
goodbye-world
|
||||
"#]],
|
||||
);
|
||||
"#]],);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -324,22 +273,22 @@ fn suggest_argument_value() {
|
|||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--input [TAB]", current_dir = Some(testdir_path)),
|
||||
snapbox::str![
|
||||
"a_file
|
||||
snapbox::str![[r#"
|
||||
a_file
|
||||
b_file
|
||||
c_dir/
|
||||
d_dir/"
|
||||
],
|
||||
d_dir/
|
||||
"#]],
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-i [TAB]", current_dir = Some(testdir_path)),
|
||||
snapbox::str![
|
||||
"a_file
|
||||
snapbox::str![[r#"
|
||||
a_file
|
||||
b_file
|
||||
c_dir/
|
||||
d_dir/"
|
||||
],
|
||||
d_dir/
|
||||
"#]],
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
|
@ -352,23 +301,17 @@ d_dir/"
|
|||
snapbox::str!["b_file"],
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--format [TAB]"),
|
||||
snapbox::str![
|
||||
"json
|
||||
assert_data_eq!(complete!(cmd, "--format [TAB]"), snapbox::str![[r#"
|
||||
json
|
||||
yaml
|
||||
toml"
|
||||
],
|
||||
);
|
||||
toml
|
||||
"#]],);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-F [TAB]"),
|
||||
snapbox::str![
|
||||
"json
|
||||
assert_data_eq!(complete!(cmd, "-F [TAB]"), snapbox::str![[r#"
|
||||
json
|
||||
yaml
|
||||
toml"
|
||||
],
|
||||
);
|
||||
toml
|
||||
"#]],);
|
||||
|
||||
assert_data_eq!(complete!(cmd, "--format j[TAB]"), snapbox::str!["json"],);
|
||||
|
||||
|
@ -378,50 +321,44 @@ toml"
|
|||
|
||||
assert_data_eq!(complete!(cmd, "-F t[TAB]"), snapbox::str!["toml"],);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-cccF [TAB]"),
|
||||
snapbox::str![
|
||||
"json
|
||||
assert_data_eq!(complete!(cmd, "-cccF [TAB]"), snapbox::str![[r#"
|
||||
json
|
||||
yaml
|
||||
toml"
|
||||
]
|
||||
);
|
||||
toml
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--input a_file [TAB]"),
|
||||
snapbox::str![
|
||||
"--input
|
||||
assert_data_eq!(complete!(cmd, "--input a_file [TAB]"), snapbox::str![[r#"
|
||||
--input
|
||||
--format
|
||||
--count
|
||||
--help\tPrint help
|
||||
--help Print help
|
||||
-i
|
||||
-F
|
||||
-c
|
||||
-h\tPrint help
|
||||
-h Print help
|
||||
pos_a
|
||||
pos_b
|
||||
pos_c"
|
||||
]
|
||||
);
|
||||
pos_c
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-ci[TAB]", current_dir = Some(testdir_path)),
|
||||
snapbox::str![
|
||||
"-cia_file
|
||||
snapbox::str![[r#"
|
||||
-cia_file
|
||||
-cib_file
|
||||
-cic_dir/
|
||||
-cid_dir/"
|
||||
]
|
||||
-cid_dir/
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-ci=[TAB]", current_dir = Some(testdir_path)),
|
||||
snapbox::str![
|
||||
"-ci=a_file
|
||||
snapbox::str![[r#"
|
||||
-ci=a_file
|
||||
-ci=b_file
|
||||
-ci=c_dir/
|
||||
-ci=d_dir/"
|
||||
]
|
||||
-ci=d_dir/
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
|
@ -431,12 +368,12 @@ pos_c"
|
|||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-ciF[TAB]", current_dir = Some(testdir_path)),
|
||||
snapbox::str![""]
|
||||
snapbox::str![]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-ciF=[TAB]", current_dir = Some(testdir_path)),
|
||||
snapbox::str![""]
|
||||
snapbox::str![]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -458,137 +395,110 @@ fn suggest_argument_multi_values() {
|
|||
.num_args(1..=3),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--certain-num [TAB]"),
|
||||
snapbox::str![
|
||||
"val1
|
||||
assert_data_eq!(complete!(cmd, "--certain-num [TAB]"), snapbox::str![[r#"
|
||||
val1
|
||||
val2
|
||||
val3"
|
||||
]
|
||||
);
|
||||
val3
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--certain-num val1 [TAB]"),
|
||||
snapbox::str![
|
||||
"val1
|
||||
assert_data_eq!(complete!(cmd, "--certain-num val1 [TAB]"), snapbox::str![[r#"
|
||||
val1
|
||||
val2
|
||||
val3"
|
||||
]
|
||||
);
|
||||
val3
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--certain-num val1 val2 val3 [TAB]"),
|
||||
snapbox::str![
|
||||
"--certain-num
|
||||
snapbox::str![[r#"
|
||||
--certain-num
|
||||
--uncertain-num
|
||||
--help\tPrint help
|
||||
--help Print help
|
||||
-Y
|
||||
-N
|
||||
-h\tPrint help"
|
||||
]
|
||||
-h Print help
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--uncertain-num [TAB]"),
|
||||
snapbox::str![
|
||||
"val1
|
||||
assert_data_eq!(complete!(cmd, "--uncertain-num [TAB]"), snapbox::str![[r#"
|
||||
val1
|
||||
val2
|
||||
val3"
|
||||
]
|
||||
);
|
||||
val3
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--uncertain-num val1 [TAB]"),
|
||||
snapbox::str![
|
||||
"val1
|
||||
snapbox::str![[r#"
|
||||
val1
|
||||
val2
|
||||
val3
|
||||
--certain-num
|
||||
--uncertain-num
|
||||
--help\tPrint help
|
||||
--help Print help
|
||||
-Y
|
||||
-N
|
||||
-h\tPrint help"
|
||||
]
|
||||
-h Print help
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--uncertain-num val1 val2 val3 [TAB]"),
|
||||
snapbox::str![
|
||||
"--certain-num
|
||||
snapbox::str![[r#"
|
||||
--certain-num
|
||||
--uncertain-num
|
||||
--help\tPrint help
|
||||
--help Print help
|
||||
-Y
|
||||
-N
|
||||
-h\tPrint help"
|
||||
]
|
||||
-h Print help
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-Y [TAB]"),
|
||||
snapbox::str![
|
||||
"val1
|
||||
assert_data_eq!(complete!(cmd, "-Y [TAB]"), snapbox::str![[r#"
|
||||
val1
|
||||
val2
|
||||
val3"
|
||||
]
|
||||
);
|
||||
val3
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-Y val1 [TAB]"),
|
||||
snapbox::str![
|
||||
"val1
|
||||
assert_data_eq!(complete!(cmd, "-Y val1 [TAB]"), snapbox::str![[r#"
|
||||
val1
|
||||
val2
|
||||
val3"
|
||||
]
|
||||
);
|
||||
val3
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-Y val1 val2 val3 [TAB]"),
|
||||
snapbox::str![
|
||||
"--certain-num
|
||||
assert_data_eq!(complete!(cmd, "-Y val1 val2 val3 [TAB]"), snapbox::str![[r#"
|
||||
--certain-num
|
||||
--uncertain-num
|
||||
--help\tPrint help
|
||||
--help Print help
|
||||
-Y
|
||||
-N
|
||||
-h\tPrint help"
|
||||
]
|
||||
);
|
||||
-h Print help
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-N [TAB]"),
|
||||
snapbox::str![
|
||||
"val1
|
||||
assert_data_eq!(complete!(cmd, "-N [TAB]"), snapbox::str![[r#"
|
||||
val1
|
||||
val2
|
||||
val3"
|
||||
]
|
||||
);
|
||||
val3
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-N val1 [TAB]"),
|
||||
snapbox::str![
|
||||
"val1
|
||||
assert_data_eq!(complete!(cmd, "-N val1 [TAB]"), snapbox::str![[r#"
|
||||
val1
|
||||
val2
|
||||
val3
|
||||
--certain-num
|
||||
--uncertain-num
|
||||
--help\tPrint help
|
||||
--help Print help
|
||||
-Y
|
||||
-N
|
||||
-h\tPrint help"
|
||||
]
|
||||
);
|
||||
-h Print help
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "-N val1 val2 val3 [TAB]"),
|
||||
snapbox::str![
|
||||
"--certain-num
|
||||
assert_data_eq!(complete!(cmd, "-N val1 val2 val3 [TAB]"), snapbox::str![[r#"
|
||||
--certain-num
|
||||
--uncertain-num
|
||||
--help\tPrint help
|
||||
--help Print help
|
||||
-Y
|
||||
-N
|
||||
-h\tPrint help"
|
||||
]
|
||||
);
|
||||
-h Print help
|
||||
"#]]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -612,14 +522,11 @@ fn suggest_custom_arg_value() {
|
|||
.add::<ArgValueCompleter>(ArgValueCompleter::new(MyCustomCompleter {})),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--custom [TAB]"),
|
||||
snapbox::str![
|
||||
"custom1
|
||||
assert_data_eq!(complete!(cmd, "--custom [TAB]"), snapbox::str![[r#"
|
||||
custom1
|
||||
custom2
|
||||
custom3"
|
||||
],
|
||||
);
|
||||
custom3
|
||||
"#]],);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -643,77 +550,68 @@ fn suggest_multi_positional() {
|
|||
.value_parser(["json", "yaml", "toml"]),
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "pos_1 pos_a [TAB]"),
|
||||
snapbox::str![
|
||||
"pos_a
|
||||
pos_b
|
||||
pos_c"
|
||||
]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "pos_1 pos_a pos_b [TAB]"),
|
||||
snapbox::str![
|
||||
"pos_a
|
||||
pos_b
|
||||
pos_c"
|
||||
]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--format json pos_1 [TAB]"),
|
||||
snapbox::str![
|
||||
"--format
|
||||
--help\tPrint help
|
||||
-F
|
||||
-h\tPrint help
|
||||
assert_data_eq!(complete!(cmd, "pos_1 pos_a [TAB]"), snapbox::str![[r#"
|
||||
pos_a
|
||||
pos_b
|
||||
pos_c"
|
||||
]
|
||||
);
|
||||
pos_c
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(complete!(cmd, "pos_1 pos_a pos_b [TAB]"), snapbox::str![[r#"
|
||||
pos_a
|
||||
pos_b
|
||||
pos_c
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(complete!(cmd, "--format json pos_1 [TAB]"), snapbox::str![[r#"
|
||||
--format
|
||||
--help Print help
|
||||
-F
|
||||
-h Print help
|
||||
pos_a
|
||||
pos_b
|
||||
pos_c
|
||||
"#]]);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--format json pos_1 pos_a [TAB]"),
|
||||
snapbox::str![
|
||||
"pos_a
|
||||
snapbox::str![[r#"
|
||||
pos_a
|
||||
pos_b
|
||||
pos_c"
|
||||
]
|
||||
pos_c
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--format json pos_1 pos_a pos_b pos_c [TAB]"),
|
||||
snapbox::str![
|
||||
"--format
|
||||
--help\tPrint help
|
||||
snapbox::str![[r#"
|
||||
--format
|
||||
--help Print help
|
||||
-F
|
||||
-h\tPrint help"
|
||||
]
|
||||
-h Print help
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--format json -- pos_1 pos_a [TAB]"),
|
||||
snapbox::str![
|
||||
"pos_a
|
||||
snapbox::str![[r#"
|
||||
pos_a
|
||||
pos_b
|
||||
pos_c"
|
||||
]
|
||||
pos_c
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--format json -- pos_1 pos_a pos_b [TAB]"),
|
||||
snapbox::str![
|
||||
"pos_a
|
||||
snapbox::str![[r#"
|
||||
pos_a
|
||||
pos_b
|
||||
pos_c"
|
||||
]
|
||||
pos_c
|
||||
"#]]
|
||||
);
|
||||
|
||||
assert_data_eq!(
|
||||
complete!(cmd, "--format json -- pos_1 pos_a pos_b pos_c [TAB]"),
|
||||
snapbox::str![""]
|
||||
snapbox::str![]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -193,24 +193,24 @@ fn complete_dynamic() {
|
|||
common::load_runtime::<completest_pty::ElvishRuntimeBuilder>("dynamic", "exhaustive");
|
||||
|
||||
let input = "exhaustive \t";
|
||||
let expected = snapbox::str![
|
||||
r#"% exhaustive --generate
|
||||
let expected = snapbox::str![[r#"
|
||||
% exhaustive --generate
|
||||
COMPLETING argument
|
||||
--generate --help -V action help last quote
|
||||
--global --version -h alias hint pacman value"#
|
||||
];
|
||||
--global --version -h alias hint pacman value
|
||||
"#]];
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
assert_data_eq!(actual, expected);
|
||||
|
||||
let input = "exhaustive quote \t";
|
||||
let expected = snapbox::str![
|
||||
r#"% exhaustive quote --backslash
|
||||
let expected = snapbox::str![[r#"
|
||||
% exhaustive quote --backslash
|
||||
COMPLETING argument
|
||||
--backslash --double-quotes --single-quotes cmd-backslash cmd-expansions
|
||||
--backticks --expansions --version cmd-backticks cmd-single-quotes
|
||||
--brackets --global -V cmd-brackets escape-help
|
||||
--choice --help -h cmd-double-quotes help "#
|
||||
];
|
||||
--choice --help -h cmd-double-quotes help
|
||||
"#]];
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
assert_data_eq!(actual, expected);
|
||||
}
|
||||
|
|
|
@ -181,22 +181,22 @@ fn complete_dynamic() {
|
|||
common::load_runtime::<completest_pty::ZshRuntimeBuilder>("dynamic", "exhaustive");
|
||||
|
||||
let input = "exhaustive \t\t";
|
||||
let expected = snapbox::str![
|
||||
r#"% exhaustive
|
||||
let expected = snapbox::str![[r#"
|
||||
% exhaustive
|
||||
--generate --help -V action help last quote
|
||||
--global --version -h alias hint pacman value "#
|
||||
];
|
||||
--global --version -h alias hint pacman value
|
||||
"#]];
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
assert_data_eq!(actual, expected);
|
||||
|
||||
let input = "exhaustive quote \t\t";
|
||||
let expected = snapbox::str![
|
||||
r#"% exhaustive quote
|
||||
let expected = snapbox::str![[r#"
|
||||
% exhaustive quote
|
||||
--backslash --double-quotes --single-quotes cmd-backslash cmd-expansions
|
||||
--backticks --expansions --version cmd-backticks cmd-single-quotes
|
||||
--brackets --global -V cmd-brackets escape-help
|
||||
--choice --help -h cmd-double-quotes help "#
|
||||
];
|
||||
--choice --help -h cmd-double-quotes help
|
||||
"#]];
|
||||
let actual = runtime.complete(input, &term).unwrap();
|
||||
assert_data_eq!(actual, expected);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue