(t *testing.T)
| 265 | } |
| 266 | |
| 267 | func TestString_InList(t *testing.T) { |
| 268 | t.Run("basic", func(t *testing.T) { |
| 269 | cases := []struct { |
| 270 | name string |
| 271 | str string |
| 272 | value []string |
| 273 | wantInList chainResult |
| 274 | wantInListFold chainResult |
| 275 | }{ |
| 276 | { |
| 277 | name: "in list", |
| 278 | str: "foo", |
| 279 | value: []string{"foo", "bar"}, |
| 280 | wantInList: success, |
| 281 | wantInListFold: success, |
| 282 | }, |
| 283 | { |
| 284 | name: "not in list", |
| 285 | str: "baz", |
| 286 | value: []string{"foo", "bar"}, |
| 287 | wantInList: failure, |
| 288 | wantInListFold: failure, |
| 289 | }, |
| 290 | { |
| 291 | name: "different case", |
| 292 | str: "FOO", |
| 293 | value: []string{"foo", "bar"}, |
| 294 | wantInList: failure, |
| 295 | wantInListFold: success, |
| 296 | }, |
| 297 | } |
| 298 | |
| 299 | for _, tc := range cases { |
| 300 | reporter := newMockReporter(t) |
| 301 | |
| 302 | NewString(reporter, tc.str).InList(tc.value...). |
| 303 | chain.assert(t, tc.wantInList) |
| 304 | NewString(reporter, tc.str).NotInList(tc.value...). |
| 305 | chain.assert(t, !tc.wantInList) |
| 306 | |
| 307 | NewString(reporter, tc.str).InListFold(tc.value...). |
| 308 | chain.assert(t, tc.wantInListFold) |
| 309 | NewString(reporter, tc.str).NotInListFold(tc.value...). |
| 310 | chain.assert(t, !tc.wantInListFold) |
| 311 | } |
| 312 | }) |
| 313 | |
| 314 | t.Run("invalid argument", func(t *testing.T) { |
| 315 | reporter := newMockReporter(t) |
| 316 | |
| 317 | NewString(reporter, "foo").InList(). |
| 318 | chain.assert(t, failure) |
| 319 | NewString(reporter, "foo").NotInList(). |
| 320 | chain.assert(t, failure) |
| 321 | |
| 322 | NewString(reporter, "foo").InListFold(). |
| 323 | chain.assert(t, failure) |
| 324 | NewString(reporter, "foo").NotInListFold(). |
nothing calls this directly
no test coverage detected
searching dependent graphs…