Skip to content

Commit 48a23f5

Browse files
committed
test(clap_complete): Add test cases for -fbar and -f=bar completion
1 parent 5efa52a commit 48a23f5

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

clap_complete/tests/testsuite/dynamic.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,56 @@ pos_b
402402
pos_c"
403403
]
404404
);
405+
406+
assert_data_eq!(
407+
complete!(cmd, "-ci[TAB]", current_dir = Some(testdir_path)),
408+
snapbox::str![
409+
"-cii
410+
-ciF
411+
-cic
412+
-cih Print help"
413+
]
414+
);
415+
416+
assert_data_eq!(
417+
complete!(cmd, "-ci=[TAB]", current_dir = Some(testdir_path)),
418+
snapbox::str![
419+
"-ci=i
420+
-ci=F
421+
-ci=c
422+
-ci=h Print help"
423+
]
424+
);
425+
426+
assert_data_eq!(
427+
complete!(cmd, "-ci=a[TAB]", current_dir = Some(testdir_path)),
428+
snapbox::str![
429+
"-ci=ai
430+
-ci=aF
431+
-ci=ac
432+
-ci=ah Print help"
433+
]
434+
);
435+
436+
assert_data_eq!(
437+
complete!(cmd, "-ciF[TAB]", current_dir = Some(testdir_path)),
438+
snapbox::str![
439+
"-ciFi
440+
-ciFF
441+
-ciFc
442+
-ciFh\tPrint help"
443+
]
444+
);
445+
446+
assert_data_eq!(
447+
complete!(cmd, "-ciF=[TAB]", current_dir = Some(testdir_path)),
448+
snapbox::str![
449+
"-ciF=i
450+
-ciF=F
451+
-ciF=c
452+
-ciF=h\tPrint help"
453+
]
454+
)
405455
}
406456

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

0 commit comments

Comments
 (0)