(t *testing.T)
| 176 | } |
| 177 | |
| 178 | func TestSSWithComma(t *testing.T) { |
| 179 | var ss []string |
| 180 | f := setUpSSFlagSet(&ss) |
| 181 | |
| 182 | in := []string{`"one,two"`, `"three"`, `"four,five",six`} |
| 183 | expected := []string{"one,two", "three", "four,five", "six"} |
| 184 | argfmt := "--ss=%s" |
| 185 | arg1 := fmt.Sprintf(argfmt, in[0]) |
| 186 | arg2 := fmt.Sprintf(argfmt, in[1]) |
| 187 | arg3 := fmt.Sprintf(argfmt, in[2]) |
| 188 | err := f.Parse([]string{arg1, arg2, arg3}) |
| 189 | if err != nil { |
| 190 | t.Fatal("expected no error; got", err) |
| 191 | } |
| 192 | |
| 193 | if len(expected) != len(ss) { |
| 194 | t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss)) |
| 195 | } |
| 196 | for i, v := range ss { |
| 197 | if expected[i] != v { |
| 198 | t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | values, err := f.GetStringSlice("ss") |
| 203 | if err != nil { |
| 204 | t.Fatal("expected no error; got", err) |
| 205 | } |
| 206 | |
| 207 | if len(expected) != len(values) { |
| 208 | t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) |
| 209 | } |
| 210 | for i, v := range values { |
| 211 | if expected[i] != v { |
| 212 | t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v) |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | func TestSSWithSquareBrackets(t *testing.T) { |
| 218 | var ss []string |
nothing calls this directly
no test coverage detected