aboutsummaryrefslogtreecommitdiff
path: root/int_slice_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'int_slice_test.go')
-rw-r--r--int_slice_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/int_slice_test.go b/int_slice_test.go
index d162e86..927e7f4 100644
--- a/int_slice_test.go
+++ b/int_slice_test.go
@@ -47,3 +47,23 @@ func TestIS(t *testing.T) {
}
}
}
+
+func TestISCalledTwice(t *testing.T) {
+ var is []int
+ f := setUpISFlagSet(&is)
+
+ in := []string{"1,2", "3"}
+ expected := []int{1, 2, 3}
+ argfmt := "--is=%s"
+ arg1 := fmt.Sprintf(argfmt, in[0])
+ arg2 := fmt.Sprintf(argfmt, in[1])
+ err := f.Parse([]string{arg1, arg2})
+ if err != nil {
+ t.Fatal("expected no error; got", err)
+ }
+ for i, v := range is {
+ if expected[i] != v {
+ t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v)
+ }
+ }
+}