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

Function TestBoolP

bool_test.go:166–179  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

164}
165
166func TestBoolP(t *testing.T) {
167 b := BoolP("bool", "b", false, "bool value in CommandLine")
168 c := BoolP("c", "c", false, "other bool value")
169 args := []string{"--bool"}
170 if err := CommandLine.Parse(args); err != nil {
171 t.Error("expected no error, got ", err)
172 }
173 if *b != true {
174 t.Errorf("expected b=true got b=%v", *b)
175 }
176 if *c != false {
177 t.Errorf("expect c=false got c=%v", *c)
178 }
179}

Callers

nothing calls this directly

Calls 3

BoolPFunction · 0.85
ParseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected