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

Function TestManPrintFlagsHidesShortDeprecated

doc/man_docs_test.go:149–162  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func TestManPrintFlagsHidesShortDeprecated(t *testing.T) {
150 c := &cobra.Command{}
151 c.Flags().StringP("foo", "f", "default", "Foo flag")
152 assertNoErr(t, c.Flags().MarkShorthandDeprecated("foo", "don't use it no more"))
153
154 buf := new(bytes.Buffer)
155 manPrintFlags(buf, c.Flags())
156
157 got := buf.String()
158 expected := "**--foo**=\"default\"\n\tFoo flag\n\n"
159 if got != expected {
160 t.Errorf("Expected %v, got %v", expected, got)
161 }
162}
163
164func TestGenManTree(t *testing.T) {
165 c := &cobra.Command{Use: "do [OPTIONS] arg1 arg2"}

Callers

nothing calls this directly

Calls 4

FlagsMethod · 0.95
manPrintFlagsFunction · 0.85
StringMethod · 0.80
assertNoErrFunction · 0.70

Tested by

no test coverage detected