MCPcopy
hub / github.com/spf13/pflag / TestPrintUsage

Function TestPrintUsage

printusage_test.go:27–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestPrintUsage(t *testing.T) {
28 buf := bytes.Buffer{}
29 f := setUpPFlagSet(&buf)
30 f.PrintDefaults()
31 res := buf.String()
32 if res != expectedOutput {
33 t.Errorf("Expected \n%s \nActual \n%s", expectedOutput, res)
34 }
35}
36
37func setUpPFlagSet2(buf io.Writer) *FlagSet {
38 f := NewFlagSet("test", ExitOnError)

Callers

nothing calls this directly

Calls 3

setUpPFlagSetFunction · 0.85
PrintDefaultsMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected