(t *testing.T)
| 270 | } |
| 271 | |
| 272 | func TestDuration_InList(t *testing.T) { |
| 273 | cases := []struct { |
| 274 | name string |
| 275 | value time.Duration |
| 276 | list []time.Duration |
| 277 | wantInList chainResult |
| 278 | wantNotInList chainResult |
| 279 | }{ |
| 280 | { |
| 281 | name: "empty list", |
| 282 | value: time.Second, |
| 283 | list: []time.Duration{}, |
| 284 | wantInList: failure, |
| 285 | wantNotInList: failure, |
| 286 | }, |
| 287 | { |
| 288 | name: "value present in list", |
| 289 | value: time.Second, |
| 290 | list: []time.Duration{time.Second, time.Minute}, |
| 291 | wantInList: success, |
| 292 | wantNotInList: failure, |
| 293 | }, |
| 294 | { |
| 295 | name: "value not present in list", |
| 296 | value: time.Second, |
| 297 | list: []time.Duration{time.Second - 1, time.Second + 1}, |
| 298 | wantInList: failure, |
| 299 | wantNotInList: success, |
| 300 | }, |
| 301 | } |
| 302 | |
| 303 | for _, tc := range cases { |
| 304 | t.Run(tc.name, func(t *testing.T) { |
| 305 | reporter := newMockReporter(t) |
| 306 | |
| 307 | NewDuration(reporter, tc.value).InList(tc.list...). |
| 308 | chain.assert(t, tc.wantInList) |
| 309 | |
| 310 | NewDuration(reporter, tc.value).NotInList(tc.list...). |
| 311 | chain.assert(t, tc.wantNotInList) |
| 312 | }) |
| 313 | } |
| 314 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…