blob: e0364e9e7f6412dab01ad916a85a192e0476799a [file] [log] [blame]
Jonathan Hart4b110f62020-03-13 17:36:19 -07001/*
2* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
3* THIS FILE MUST NOT BE EDITED BY HAND
4 */
5
6package assert
7
8import (
9 http "net/http"
10 url "net/url"
11 time "time"
12)
13
14// Conditionf uses a Comparison to assert a complex condition.
15func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {
16 if h, ok := t.(tHelper); ok {
17 h.Helper()
18 }
19 return Condition(t, comp, append([]interface{}{msg}, args...)...)
20}
21
22// Containsf asserts that the specified string, list(array, slice...) or map contains the
23// specified substring or element.
24//
25// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
26// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
27// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
28func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
29 if h, ok := t.(tHelper); ok {
30 h.Helper()
31 }
32 return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
33}
34
35// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
36func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
37 if h, ok := t.(tHelper); ok {
38 h.Helper()
39 }
40 return DirExists(t, path, append([]interface{}{msg}, args...)...)
41}
42
43// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
44// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
45// the number of appearances of each of them in both lists should match.
46//
47// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
48func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
49 if h, ok := t.(tHelper); ok {
50 h.Helper()
51 }
52 return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
53}
54
55// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
56// a slice or a channel with len == 0.
57//
58// assert.Emptyf(t, obj, "error message %s", "formatted")
59func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
60 if h, ok := t.(tHelper); ok {
61 h.Helper()
62 }
63 return Empty(t, object, append([]interface{}{msg}, args...)...)
64}
65
66// Equalf asserts that two objects are equal.
67//
68// assert.Equalf(t, 123, 123, "error message %s", "formatted")
69//
70// Pointer variable equality is determined based on the equality of the
71// referenced values (as opposed to the memory addresses). Function equality
72// cannot be determined and will always fail.
73func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
74 if h, ok := t.(tHelper); ok {
75 h.Helper()
76 }
77 return Equal(t, expected, actual, append([]interface{}{msg}, args...)...)
78}
79
80// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
81// and that it is equal to the provided error.
82//
83// actualObj, err := SomeFunction()
84// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
85func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {
86 if h, ok := t.(tHelper); ok {
87 h.Helper()
88 }
89 return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)
90}
91
92// EqualValuesf asserts that two objects are equal or convertable to the same types
93// and equal.
94//
95// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
96func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
97 if h, ok := t.(tHelper); ok {
98 h.Helper()
99 }
100 return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
101}
102
103// Errorf asserts that a function returned an error (i.e. not `nil`).
104//
105// actualObj, err := SomeFunction()
106// if assert.Errorf(t, err, "error message %s", "formatted") {
107// assert.Equal(t, expectedErrorf, err)
108// }
109func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
110 if h, ok := t.(tHelper); ok {
111 h.Helper()
112 }
113 return Error(t, err, append([]interface{}{msg}, args...)...)
114}
115
116// Eventuallyf asserts that given condition will be met in waitFor time,
117// periodically checking target function each tick.
118//
119// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
120func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
121 if h, ok := t.(tHelper); ok {
122 h.Helper()
123 }
124 return Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
125}
126
127// Exactlyf asserts that two objects are equal in value and type.
128//
129// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
130func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
131 if h, ok := t.(tHelper); ok {
132 h.Helper()
133 }
134 return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)
135}
136
137// Failf reports a failure through
138func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
139 if h, ok := t.(tHelper); ok {
140 h.Helper()
141 }
142 return Fail(t, failureMessage, append([]interface{}{msg}, args...)...)
143}
144
145// FailNowf fails test
146func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
147 if h, ok := t.(tHelper); ok {
148 h.Helper()
149 }
150 return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)
151}
152
153// Falsef asserts that the specified value is false.
154//
155// assert.Falsef(t, myBool, "error message %s", "formatted")
156func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
157 if h, ok := t.(tHelper); ok {
158 h.Helper()
159 }
160 return False(t, value, append([]interface{}{msg}, args...)...)
161}
162
163// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
164func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
165 if h, ok := t.(tHelper); ok {
166 h.Helper()
167 }
168 return FileExists(t, path, append([]interface{}{msg}, args...)...)
169}
170
171// Greaterf asserts that the first element is greater than the second
172//
173// assert.Greaterf(t, 2, 1, "error message %s", "formatted")
174// assert.Greaterf(t, float64(2, "error message %s", "formatted"), float64(1))
175// assert.Greaterf(t, "b", "a", "error message %s", "formatted")
176func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
177 if h, ok := t.(tHelper); ok {
178 h.Helper()
179 }
180 return Greater(t, e1, e2, append([]interface{}{msg}, args...)...)
181}
182
183// GreaterOrEqualf asserts that the first element is greater than or equal to the second
184//
185// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
186// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
187// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
188// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
189func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
190 if h, ok := t.(tHelper); ok {
191 h.Helper()
192 }
193 return GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
194}
195
196// HTTPBodyContainsf asserts that a specified handler returns a
197// body that contains a string.
198//
199// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
200//
201// Returns whether the assertion was successful (true) or not (false).
202func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
203 if h, ok := t.(tHelper); ok {
204 h.Helper()
205 }
206 return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
207}
208
209// HTTPBodyNotContainsf asserts that a specified handler returns a
210// body that does not contain a string.
211//
212// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
213//
214// Returns whether the assertion was successful (true) or not (false).
215func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
216 if h, ok := t.(tHelper); ok {
217 h.Helper()
218 }
219 return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
220}
221
222// HTTPErrorf asserts that a specified handler returns an error status code.
223//
224// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
225//
226// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
227func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
228 if h, ok := t.(tHelper); ok {
229 h.Helper()
230 }
231 return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
232}
233
234// HTTPRedirectf asserts that a specified handler returns a redirect status code.
235//
236// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
237//
238// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
239func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
240 if h, ok := t.(tHelper); ok {
241 h.Helper()
242 }
243 return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
244}
245
246// HTTPSuccessf asserts that a specified handler returns a success status code.
247//
248// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
249//
250// Returns whether the assertion was successful (true) or not (false).
251func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
252 if h, ok := t.(tHelper); ok {
253 h.Helper()
254 }
255 return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
256}
257
258// Implementsf asserts that an object is implemented by the specified interface.
259//
260// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
261func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
262 if h, ok := t.(tHelper); ok {
263 h.Helper()
264 }
265 return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
266}
267
268// InDeltaf asserts that the two numerals are within delta of each other.
269//
270// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
271func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
272 if h, ok := t.(tHelper); ok {
273 h.Helper()
274 }
275 return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
276}
277
278// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
279func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
280 if h, ok := t.(tHelper); ok {
281 h.Helper()
282 }
283 return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
284}
285
286// InDeltaSlicef is the same as InDelta, except it compares two slices.
287func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
288 if h, ok := t.(tHelper); ok {
289 h.Helper()
290 }
291 return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
292}
293
294// InEpsilonf asserts that expected and actual have a relative error less than epsilon
295func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
296 if h, ok := t.(tHelper); ok {
297 h.Helper()
298 }
299 return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
300}
301
302// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
303func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
304 if h, ok := t.(tHelper); ok {
305 h.Helper()
306 }
307 return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
308}
309
310// IsTypef asserts that the specified objects are of the same type.
311func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
312 if h, ok := t.(tHelper); ok {
313 h.Helper()
314 }
315 return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)
316}
317
318// JSONEqf asserts that two JSON strings are equivalent.
319//
320// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
321func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
322 if h, ok := t.(tHelper); ok {
323 h.Helper()
324 }
325 return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)
326}
327
328// YAMLEqf asserts that two YAML strings are equivalent.
329func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
330 if h, ok := t.(tHelper); ok {
331 h.Helper()
332 }
333 return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...)
334}
335
336// Lenf asserts that the specified object has specific length.
337// Lenf also fails if the object has a type that len() not accept.
338//
339// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
340func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {
341 if h, ok := t.(tHelper); ok {
342 h.Helper()
343 }
344 return Len(t, object, length, append([]interface{}{msg}, args...)...)
345}
346
347// Lessf asserts that the first element is less than the second
348//
349// assert.Lessf(t, 1, 2, "error message %s", "formatted")
350// assert.Lessf(t, float64(1, "error message %s", "formatted"), float64(2))
351// assert.Lessf(t, "a", "b", "error message %s", "formatted")
352func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
353 if h, ok := t.(tHelper); ok {
354 h.Helper()
355 }
356 return Less(t, e1, e2, append([]interface{}{msg}, args...)...)
357}
358
359// LessOrEqualf asserts that the first element is less than or equal to the second
360//
361// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
362// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
363// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
364// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
365func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
366 if h, ok := t.(tHelper); ok {
367 h.Helper()
368 }
369 return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
370}
371
372// Nilf asserts that the specified object is nil.
373//
374// assert.Nilf(t, err, "error message %s", "formatted")
375func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
376 if h, ok := t.(tHelper); ok {
377 h.Helper()
378 }
379 return Nil(t, object, append([]interface{}{msg}, args...)...)
380}
381
382// NoErrorf asserts that a function returned no error (i.e. `nil`).
383//
384// actualObj, err := SomeFunction()
385// if assert.NoErrorf(t, err, "error message %s", "formatted") {
386// assert.Equal(t, expectedObj, actualObj)
387// }
388func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
389 if h, ok := t.(tHelper); ok {
390 h.Helper()
391 }
392 return NoError(t, err, append([]interface{}{msg}, args...)...)
393}
394
395// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
396// specified substring or element.
397//
398// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
399// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
400// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
401func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
402 if h, ok := t.(tHelper); ok {
403 h.Helper()
404 }
405 return NotContains(t, s, contains, append([]interface{}{msg}, args...)...)
406}
407
408// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
409// a slice or a channel with len == 0.
410//
411// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
412// assert.Equal(t, "two", obj[1])
413// }
414func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
415 if h, ok := t.(tHelper); ok {
416 h.Helper()
417 }
418 return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
419}
420
421// NotEqualf asserts that the specified values are NOT equal.
422//
423// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
424//
425// Pointer variable equality is determined based on the equality of the
426// referenced values (as opposed to the memory addresses).
427func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
428 if h, ok := t.(tHelper); ok {
429 h.Helper()
430 }
431 return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)
432}
433
434// NotNilf asserts that the specified object is not nil.
435//
436// assert.NotNilf(t, err, "error message %s", "formatted")
437func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
438 if h, ok := t.(tHelper); ok {
439 h.Helper()
440 }
441 return NotNil(t, object, append([]interface{}{msg}, args...)...)
442}
443
444// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
445//
446// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
447func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
448 if h, ok := t.(tHelper); ok {
449 h.Helper()
450 }
451 return NotPanics(t, f, append([]interface{}{msg}, args...)...)
452}
453
454// NotRegexpf asserts that a specified regexp does not match a string.
455//
456// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
457// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
458func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
459 if h, ok := t.(tHelper); ok {
460 h.Helper()
461 }
462 return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)
463}
464
465// NotSubsetf asserts that the specified list(array, slice...) contains not all
466// elements given in the specified subset(array, slice...).
467//
468// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
469func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
470 if h, ok := t.(tHelper); ok {
471 h.Helper()
472 }
473 return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
474}
475
476// NotZerof asserts that i is not the zero value for its type.
477func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
478 if h, ok := t.(tHelper); ok {
479 h.Helper()
480 }
481 return NotZero(t, i, append([]interface{}{msg}, args...)...)
482}
483
484// Panicsf asserts that the code inside the specified PanicTestFunc panics.
485//
486// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
487func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
488 if h, ok := t.(tHelper); ok {
489 h.Helper()
490 }
491 return Panics(t, f, append([]interface{}{msg}, args...)...)
492}
493
494// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
495// the recovered panic value equals the expected panic value.
496//
497// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
498func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
499 if h, ok := t.(tHelper); ok {
500 h.Helper()
501 }
502 return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
503}
504
505// Regexpf asserts that a specified regexp matches a string.
506//
507// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
508// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
509func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
510 if h, ok := t.(tHelper); ok {
511 h.Helper()
512 }
513 return Regexp(t, rx, str, append([]interface{}{msg}, args...)...)
514}
515
516// Samef asserts that two pointers reference the same object.
517//
518// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted")
519//
520// Both arguments must be pointer variables. Pointer variable sameness is
521// determined based on the equality of both type and value.
522func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
523 if h, ok := t.(tHelper); ok {
524 h.Helper()
525 }
526 return Same(t, expected, actual, append([]interface{}{msg}, args...)...)
527}
528
529// Subsetf asserts that the specified list(array, slice...) contains all
530// elements given in the specified subset(array, slice...).
531//
532// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
533func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
534 if h, ok := t.(tHelper); ok {
535 h.Helper()
536 }
537 return Subset(t, list, subset, append([]interface{}{msg}, args...)...)
538}
539
540// Truef asserts that the specified value is true.
541//
542// assert.Truef(t, myBool, "error message %s", "formatted")
543func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
544 if h, ok := t.(tHelper); ok {
545 h.Helper()
546 }
547 return True(t, value, append([]interface{}{msg}, args...)...)
548}
549
550// WithinDurationf asserts that the two times are within duration delta of each other.
551//
552// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
553func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
554 if h, ok := t.(tHelper); ok {
555 h.Helper()
556 }
557 return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
558}
559
560// Zerof asserts that i is the zero value for its type.
561func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
562 if h, ok := t.(tHelper); ok {
563 h.Helper()
564 }
565 return Zero(t, i, append([]interface{}{msg}, args...)...)
566}