aboutsummaryrefslogtreecommitdiff
path: root/int_slice_test.go
diff options
context:
space:
mode:
authorEric Paris <[email protected]>2015-08-05 12:00:39 -0500
committerEric Paris <[email protected]>2015-08-05 12:00:39 -0500
commit08f04032975dbfebf7a5946d581eae0724af18f4 (patch)
tree6655dd93a25fe82dfe6362ba8c87f874158834f4 /int_slice_test.go
parentaf83f852cb3533df209ffef0b0f36b65d4594848 (diff)
parent90b831e61ee0ea159e0d00bb0c1ee3cd0c1dcdcd (diff)
Merge pull request #35 from eparis/slice-multi-call
String and Int slices called twice should append not overwrite
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)
+ }
+ }
+}