(t *testing.T)
| 238 | } |
| 239 | |
| 240 | func TestStringSlice(t *testing.T) { |
| 241 | tests := []struct { |
| 242 | input string |
| 243 | want []string |
| 244 | }{ |
| 245 | {input: "one,two,three", want: []string{"one", "two", "three"}}, |
| 246 | {input: " one , two , three ", want: []string{"one", "two", "three"}}, |
| 247 | {input: "single", want: []string{"single"}}, |
| 248 | {input: "", want: nil}, |
| 249 | } |
| 250 | |
| 251 | for _, tt := range tests { |
| 252 | t.Run(tt.input, func(t *testing.T) { |
| 253 | t.Setenv(testVar, tt.input) |
| 254 | desc := env.StringSlice(testVar) |
| 255 | |
| 256 | var result []string |
| 257 | require.NoError(t, desc.Parse(&result)) |
| 258 | |
| 259 | assert.Equal(t, tt.want, result) |
| 260 | }) |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | func TestStringSliceSep(t *testing.T) { |
| 265 | const sepVar = "TEST_SEP_VAR" |
nothing calls this directly
no test coverage detected