Skip to content

Commit

Permalink
test(complete): Add test for external subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
shannmu committed Oct 7, 2024
1 parent d2874a5 commit 6a09122
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions clap_complete/tests/testsuite/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,24 @@ pos_b
);
}

#[test]
fn suggest_external_subcommand() {
let mut cmd = Command::new("dynamic")
.arg(clap::Arg::new("positional").value_parser(["pos1", "pos2", "pos3"]));

assert_data_eq!(
complete!(cmd, " [TAB]"),
snapbox::str![
"--help\tPrint help
-h\tPrint help
pos1
pos2
pos3
"
]
);
}

#[test]
fn sort_and_filter() {
let mut cmd = Command::new("exhaustive")
Expand Down

0 comments on commit 6a09122

Please sign in to comment.