mirror of
https://github.com/spf13/cobra
synced 2024-11-05 05:17:12 +00:00
add test to check required flags will be ignored for bash, zsh, fish, powershell completion
This commit is contained in:
parent
314c9b86c2
commit
10b0388a6e
1 changed files with 11 additions and 0 deletions
|
@ -2447,6 +2447,17 @@ func TestDefaultCompletionCmd(t *testing.T) {
|
|||
rootCmd.CompletionOptions.HiddenDefaultCmd = false
|
||||
// Remove completion command for the next test
|
||||
removeCompCmd(rootCmd)
|
||||
|
||||
// Test that required flag will be ignored
|
||||
rootCmd.PersistentFlags().Bool("foo", false, "")
|
||||
assertNoErr(t, rootCmd.MarkPersistentFlagRequired("foo"))
|
||||
for _, shell := range []string{"bash", "fish", "powershell", "zsh"} {
|
||||
if _, err = executeCommand(rootCmd, compCmdName, shell); err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
// Remove completion command for the next test
|
||||
removeCompCmd(rootCmd)
|
||||
}
|
||||
|
||||
func TestCompleteCompletion(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue