aboutsummaryrefslogtreecommitdiff
path: root/int_slice_test.go
diff options
context:
space:
mode:
authorEric Paris <[email protected]>2015-08-05 14:07:06 -0400
committerEric Paris <[email protected]>2015-08-05 14:07:06 -0400
commit5108914a6cad76dd1c00d1fbe069f5809677e6a0 (patch)
tree6cf0e5e12144fde8eb6a1a847863b4d0b0b3ef24 /int_slice_test.go
parent08f04032975dbfebf7a5946d581eae0724af18f4 (diff)
Empty slices should be empty, not have a single (empty) string
Diffstat (limited to 'int_slice_test.go')
-rw-r--r--int_slice_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/int_slice_test.go b/int_slice_test.go
index 927e7f4..32c7cd7 100644
--- a/int_slice_test.go
+++ b/int_slice_test.go
@@ -17,6 +17,23 @@ func setUpISFlagSet(isp *[]int) *FlagSet {
return f
}
+func TestEmptyIS(t *testing.T) {
+ var is []int
+ f := setUpISFlagSet(&is)
+ err := f.Parse([]string{})
+ if err != nil {
+ t.Fatal("expected no error; got", err)
+ }
+
+ getIS, err := f.GetIntSlice("is")
+ if err != nil {
+ t.Fatal("got an error from GetStringSlice():", err)
+ }
+ if len(getIS) != 0 {
+ t.Fatalf("got is %v with len=%d but expected length=0", getIS, len(getIS))
+ }
+}
+
func TestIS(t *testing.T) {
var is []int
f := setUpISFlagSet(&is)