MCPcopy
hub / github.com/spf13/cobra / TestBashCompletionHiddenFlag

Function TestBashCompletionHiddenFlag

bash_completions_test.go:229–243  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

227}
228
229func TestBashCompletionHiddenFlag(t *testing.T) {
230 c := &Command{Use: "c", Run: emptyRun}
231
232 const flagName = "hiddenFlag"
233 c.Flags().Bool(flagName, false, "")
234 assertNoErr(t, c.Flags().MarkHidden(flagName))
235
236 buf := new(bytes.Buffer)
237 assertNoErr(t, c.GenBashCompletion(buf))
238 output := buf.String()
239
240 if strings.Contains(output, flagName) {
241 t.Errorf("Expected completion to not include %q flag: Got %v", flagName, output)
242 }
243}
244
245func TestBashCompletionDeprecatedFlag(t *testing.T) {
246 c := &Command{Use: "c", Run: emptyRun}

Callers

nothing calls this directly

Calls 4

FlagsMethod · 0.95
GenBashCompletionMethod · 0.95
StringMethod · 0.80
assertNoErrFunction · 0.70

Tested by

no test coverage detected