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

Function TestUISCalledTwice

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

Source from the content-addressed store, hash-verified

164}
165
166func TestUISCalledTwice(t *testing.T) {
167 var uis []uint
168 f := setUpUISFlagSet(&uis)
169
170 in := []string{"1,2", "3"}
171 expected := []int{1, 2, 3}
172 argfmt := "--uis=%s"
173 arg1 := fmt.Sprintf(argfmt, in[0])
174 arg2 := fmt.Sprintf(argfmt, in[1])
175 err := f.Parse([]string{arg1, arg2})
176 if err != nil {
177 t.Fatal("expected no error; got", err)
178 }
179 for i, v := range uis {
180 if uint(expected[i]) != v {
181 t.Fatalf("expected uis[%d] to be %d but got: %d", i, expected[i], v)
182 }
183 }
184}

Callers

nothing calls this directly

Calls 2

setUpUISFlagSetFunction · 0.85
ParseMethod · 0.65

Tested by

no test coverage detected