Skip to content

Commit

Permalink
add test to check required flags will be ignored for bash, zsh, fish,…
Browse files Browse the repository at this point in the history
… powershell completion
  • Loading branch information
JunNishimura committed Jul 9, 2023
1 parent 314c9b8 commit 10b0388
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions completions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 10b0388

Please sign in to comment.