MCPcopy
hub / github.com/stretchr/testify / TestWithinDuration

Function TestWithinDuration

require/requirements_test.go:279–292  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

277}
278
279func TestWithinDuration(t *testing.T) {
280 t.Parallel()
281
282 a := time.Now()
283 b := a.Add(10 * time.Second)
284
285 WithinDuration(t, a, b, 15*time.Second)
286
287 mockT := new(MockT)
288 WithinDuration(mockT, a, b, 5*time.Second)
289 if !mockT.Failed {
290 t.Error("Check should fail")
291 }
292}
293
294func TestInDelta(t *testing.T) {
295 t.Parallel()

Callers

nothing calls this directly

Calls 2

WithinDurationFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected