aboutsummaryrefslogtreecommitdiff
path: root/string_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 /string_slice_test.go
parent08f04032975dbfebf7a5946d581eae0724af18f4 (diff)
Empty slices should be empty, not have a single (empty) string
Diffstat (limited to 'string_slice_test.go')
-rw-r--r--string_slice_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/string_slice_test.go b/string_slice_test.go
index d5c0d03..63eb9de 100644
--- a/string_slice_test.go
+++ b/string_slice_test.go
@@ -16,6 +16,23 @@ func setUpSSFlagSet(ssp *[]string) *FlagSet {
return f
}
+func TestEmptySS(t *testing.T) {
+ var ss []string
+ f := setUpSSFlagSet(&ss)
+ err := f.Parse([]string{})
+ if err != nil {
+ t.Fatal("expected no error; got", err)
+ }
+
+ getSS, err := f.GetStringSlice("ss")
+ if err != nil {
+ t.Fatal("got an error from GetStringSlice():", err)
+ }
+ if len(getSS) != 0 {
+ t.Fatalf("got ss %v with len=%d but expected length=0", getSS, len(getSS))
+ }
+}
+
func TestSS(t *testing.T) {
var ss []string
f := setUpSSFlagSet(&ss)