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

Function WithinDuration

require/require.go:2089–2097  ·  view source on GitHub ↗

WithinDuration asserts that the two times are within duration delta of each other. require.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)

(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

2087//
2088// require.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
2089func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
2090 if h, ok := t.(tHelper); ok {
2091 h.Helper()
2092 }
2093 if assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {
2094 return
2095 }
2096 t.FailNow()
2097}
2098
2099// WithinDurationf asserts that the two times are within duration delta of each other.
2100//

Callers 2

WithinDurationMethod · 0.70
TestWithinDurationFunction · 0.70

Calls 3

WithinDurationFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by 1

TestWithinDurationFunction · 0.56