Skip to content

Commit 4a86fee

Browse files
committed
test(complete): Illustrate current behavior
1 parent 281f8ae commit 4a86fee

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

clap_complete/tests/testsuite/engine.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,27 @@ goodbye-world
263263
);
264264
}
265265

266+
#[test]
267+
fn suggest_subcommand_positional_after_escape() {
268+
let mut cmd = Command::new("exhaustive").subcommand(Command::new("hello-world").arg(
269+
clap::Arg::new("hello-world").value_parser([
270+
PossibleValue::new("hello-world").help("Say hello to the world"),
271+
"hello-moon".into(),
272+
"goodbye-world".into(),
273+
]),
274+
));
275+
276+
assert_data_eq!(
277+
complete!(cmd, "hello-world -- [TAB]"),
278+
snapbox::str![[r#"
279+
hello-world Say hello to the world
280+
hello-moon
281+
goodbye-world
282+
--help Print help (see more with '--help')
283+
"#]],
284+
);
285+
}
286+
266287
#[test]
267288
fn suggest_argument_value() {
268289
let mut cmd = Command::new("dynamic")

0 commit comments

Comments
 (0)