Skip to content

Commit

Permalink
test(clap_complete): Add test cases for -fbar and -f=bar completion
Browse files Browse the repository at this point in the history
  • Loading branch information
shannmu committed Jul 25, 2024
1 parent 5efa52a commit 48a23f5
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions clap_complete/tests/testsuite/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,56 @@ pos_b
pos_c"
]
);

assert_data_eq!(
complete!(cmd, "-ci[TAB]", current_dir = Some(testdir_path)),
snapbox::str![
"-cii
-ciF
-cic
-cih Print help"
]
);

assert_data_eq!(
complete!(cmd, "-ci=[TAB]", current_dir = Some(testdir_path)),
snapbox::str![
"-ci=i
-ci=F
-ci=c
-ci=h Print help"
]
);

assert_data_eq!(
complete!(cmd, "-ci=a[TAB]", current_dir = Some(testdir_path)),
snapbox::str![
"-ci=ai
-ci=aF
-ci=ac
-ci=ah Print help"
]
);

assert_data_eq!(
complete!(cmd, "-ciF[TAB]", current_dir = Some(testdir_path)),
snapbox::str![
"-ciFi
-ciFF
-ciFc
-ciFh\tPrint help"
]
);

assert_data_eq!(
complete!(cmd, "-ciF=[TAB]", current_dir = Some(testdir_path)),
snapbox::str![
"-ciF=i
-ciF=F
-ciF=c
-ciF=h\tPrint help"
]
)
}

fn complete(cmd: &mut Command, args: impl AsRef<str>, current_dir: Option<&Path>) -> String {
Expand Down

0 comments on commit 48a23f5

Please sign in to comment.