Skip to content

Commit 792d3ff

Browse files
committed
test: cover unsupported completion shells
1 parent e31abb6 commit 792d3ff

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

libshpool/src/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,9 @@ complete -c {bin_name} -n '__fish_{bin_name}_needs_log_level' -f -a 'off error w
531531

532532
#[cfg(test)]
533533
mod completion_tests {
534-
use super::write_completion;
534+
use clap::Parser;
535+
536+
use super::{write_completion, Args};
535537

536538
#[test]
537539
fn bash_completion_includes_dynamic_session_lookup() {
@@ -570,6 +572,16 @@ mod completion_tests {
570572
"complete -c shpool -n '__fish_shpool_needs_log_level' -f -a 'off error warn info debug trace'"
571573
));
572574
}
575+
576+
#[test]
577+
fn completion_rejects_powershell_shell() {
578+
let err = Args::try_parse_from(["shpool", "completion", "powershell"])
579+
.expect_err("powershell should not be accepted as a completion target");
580+
let err = err.to_string();
581+
582+
assert!(err.contains("invalid value 'powershell'"));
583+
assert!(err.contains("[possible values: bash, elvish, fish, zsh]"));
584+
}
573585
}
574586

575587
// Copied from the tracing-subscriber crate. This is public in

0 commit comments

Comments
 (0)