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

Function TestI32SCalledTwice

int32_slice_test.go:176–194  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

174}
175
176func TestI32SCalledTwice(t *testing.T) {
177 var is []int32
178 f := setUpI32SFlagSet(&is)
179
180 in := []string{"1,2", "3"}
181 expected := []int32{1, 2, 3}
182 argfmt := "--is=%s"
183 arg1 := fmt.Sprintf(argfmt, in[0])
184 arg2 := fmt.Sprintf(argfmt, in[1])
185 err := f.Parse([]string{arg1, arg2})
186 if err != nil {
187 t.Fatal("expected no error; got", err)
188 }
189 for i, v := range is {
190 if expected[i] != v {
191 t.Fatalf("expected is[%d] to be %d but got: %d", i, expected[i], v)
192 }
193 }
194}

Callers

nothing calls this directly

Calls 2

setUpI32SFlagSetFunction · 0.85
ParseMethod · 0.65

Tested by

no test coverage detected