MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestDuration_InList

Function TestDuration_InList

duration_test.go:272–314  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

270}
271
272func 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}

Callers

nothing calls this directly

Calls 5

newMockReporterFunction · 0.85
NewDurationFunction · 0.85
assertMethod · 0.80
InListMethod · 0.45
NotInListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…