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

Function TestEmptyS2I

string_to_int_test.go:41–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestEmptyS2I(t *testing.T) {
42 var s2i map[string]int
43 f := setUpS2IFlagSet(&s2i)
44 err := f.Parse([]string{})
45 if err != nil {
46 t.Fatal("expected no error; got", err)
47 }
48
49 getS2I, err := f.GetStringToInt("s2i")
50 if err != nil {
51 t.Fatal("got an error from GetStringToInt():", err)
52 }
53 if len(getS2I) != 0 {
54 t.Fatalf("got s2i %v with len=%d but expected length=0", getS2I, len(getS2I))
55 }
56}
57
58func TestS2I(t *testing.T) {
59 var s2i map[string]int

Callers

nothing calls this directly

Calls 3

setUpS2IFlagSetFunction · 0.85
GetStringToIntMethod · 0.80
ParseMethod · 0.65

Tested by

no test coverage detected