blob: 2d02f9bcef1b7820fb5e72e485b2d1d0e158d8e8 [file] [log] [blame]
Abhay Kumar40252eb2025-10-13 13:25:53 +00001// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.
amit.ghosh6ab2a982022-09-15 21:04:53 +02002
3package require
4
5import (
6 assert "github.com/stretchr/testify/assert"
7 http "net/http"
8 url "net/url"
9 time "time"
10)
11
12// Condition uses a Comparison to assert a complex condition.
13func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {
14 if h, ok := t.(tHelper); ok {
15 h.Helper()
16 }
17 if assert.Condition(t, comp, msgAndArgs...) {
18 return
19 }
20 t.FailNow()
21}
22
23// Conditionf uses a Comparison to assert a complex condition.
24func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {
25 if h, ok := t.(tHelper); ok {
26 h.Helper()
27 }
28 if assert.Conditionf(t, comp, msg, args...) {
29 return
30 }
31 t.FailNow()
32}
33
34// Contains asserts that the specified string, list(array, slice...) or map contains the
35// specified substring or element.
36//
Abhay Kumar40252eb2025-10-13 13:25:53 +000037// require.Contains(t, "Hello World", "World")
38// require.Contains(t, ["Hello", "World"], "World")
39// require.Contains(t, {"Hello": "World"}, "Hello")
amit.ghosh6ab2a982022-09-15 21:04:53 +020040func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
41 if h, ok := t.(tHelper); ok {
42 h.Helper()
43 }
44 if assert.Contains(t, s, contains, msgAndArgs...) {
45 return
46 }
47 t.FailNow()
48}
49
50// Containsf asserts that the specified string, list(array, slice...) or map contains the
51// specified substring or element.
52//
Abhay Kumar40252eb2025-10-13 13:25:53 +000053// require.Containsf(t, "Hello World", "World", "error message %s", "formatted")
54// require.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
55// require.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +020056func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
57 if h, ok := t.(tHelper); ok {
58 h.Helper()
59 }
60 if assert.Containsf(t, s, contains, msg, args...) {
61 return
62 }
63 t.FailNow()
64}
65
66// DirExists checks whether a directory exists in the given path. It also fails
67// if the path is a file rather a directory or there is an error checking whether it exists.
68func DirExists(t TestingT, path string, msgAndArgs ...interface{}) {
69 if h, ok := t.(tHelper); ok {
70 h.Helper()
71 }
72 if assert.DirExists(t, path, msgAndArgs...) {
73 return
74 }
75 t.FailNow()
76}
77
78// DirExistsf checks whether a directory exists in the given path. It also fails
79// if the path is a file rather a directory or there is an error checking whether it exists.
80func DirExistsf(t TestingT, path string, msg string, args ...interface{}) {
81 if h, ok := t.(tHelper); ok {
82 h.Helper()
83 }
84 if assert.DirExistsf(t, path, msg, args...) {
85 return
86 }
87 t.FailNow()
88}
89
90// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
91// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
92// the number of appearances of each of them in both lists should match.
93//
Abhay Kumar40252eb2025-10-13 13:25:53 +000094// require.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])
amit.ghosh6ab2a982022-09-15 21:04:53 +020095func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
96 if h, ok := t.(tHelper); ok {
97 h.Helper()
98 }
99 if assert.ElementsMatch(t, listA, listB, msgAndArgs...) {
100 return
101 }
102 t.FailNow()
103}
104
105// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
106// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
107// the number of appearances of each of them in both lists should match.
108//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000109// require.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200110func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {
111 if h, ok := t.(tHelper); ok {
112 h.Helper()
113 }
114 if assert.ElementsMatchf(t, listA, listB, msg, args...) {
115 return
116 }
117 t.FailNow()
118}
119
Abhay Kumar40252eb2025-10-13 13:25:53 +0000120// Empty asserts that the given value is "empty".
amit.ghosh6ab2a982022-09-15 21:04:53 +0200121//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000122// [Zero values] are "empty".
123//
124// Arrays are "empty" if every element is the zero value of the type (stricter than "empty").
125//
126// Slices, maps and channels with zero length are "empty".
127//
128// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty".
129//
130// require.Empty(t, obj)
131//
132// [Zero values]: https://go.dev/ref/spec#The_zero_value
amit.ghosh6ab2a982022-09-15 21:04:53 +0200133func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
134 if h, ok := t.(tHelper); ok {
135 h.Helper()
136 }
137 if assert.Empty(t, object, msgAndArgs...) {
138 return
139 }
140 t.FailNow()
141}
142
Abhay Kumar40252eb2025-10-13 13:25:53 +0000143// Emptyf asserts that the given value is "empty".
amit.ghosh6ab2a982022-09-15 21:04:53 +0200144//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000145// [Zero values] are "empty".
146//
147// Arrays are "empty" if every element is the zero value of the type (stricter than "empty").
148//
149// Slices, maps and channels with zero length are "empty".
150//
151// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty".
152//
153// require.Emptyf(t, obj, "error message %s", "formatted")
154//
155// [Zero values]: https://go.dev/ref/spec#The_zero_value
amit.ghosh6ab2a982022-09-15 21:04:53 +0200156func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
157 if h, ok := t.(tHelper); ok {
158 h.Helper()
159 }
160 if assert.Emptyf(t, object, msg, args...) {
161 return
162 }
163 t.FailNow()
164}
165
166// Equal asserts that two objects are equal.
167//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000168// require.Equal(t, 123, 123)
amit.ghosh6ab2a982022-09-15 21:04:53 +0200169//
170// Pointer variable equality is determined based on the equality of the
171// referenced values (as opposed to the memory addresses). Function equality
172// cannot be determined and will always fail.
173func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
174 if h, ok := t.(tHelper); ok {
175 h.Helper()
176 }
177 if assert.Equal(t, expected, actual, msgAndArgs...) {
178 return
179 }
180 t.FailNow()
181}
182
183// EqualError asserts that a function returned an error (i.e. not `nil`)
184// and that it is equal to the provided error.
185//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000186// actualObj, err := SomeFunction()
187// require.EqualError(t, err, expectedErrorString)
amit.ghosh6ab2a982022-09-15 21:04:53 +0200188func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
189 if h, ok := t.(tHelper); ok {
190 h.Helper()
191 }
192 if assert.EqualError(t, theError, errString, msgAndArgs...) {
193 return
194 }
195 t.FailNow()
196}
197
198// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
199// and that it is equal to the provided error.
200//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000201// actualObj, err := SomeFunction()
202// require.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200203func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {
204 if h, ok := t.(tHelper); ok {
205 h.Helper()
206 }
207 if assert.EqualErrorf(t, theError, errString, msg, args...) {
208 return
209 }
210 t.FailNow()
211}
212
Abhay Kumar40252eb2025-10-13 13:25:53 +0000213// EqualExportedValues asserts that the types of two objects are equal and their public
214// fields are also equal. This is useful for comparing structs that have private fields
215// that could potentially differ.
amit.ghosh6ab2a982022-09-15 21:04:53 +0200216//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000217// type S struct {
218// Exported int
219// notExported int
220// }
221// require.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true
222// require.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false
223func EqualExportedValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
224 if h, ok := t.(tHelper); ok {
225 h.Helper()
226 }
227 if assert.EqualExportedValues(t, expected, actual, msgAndArgs...) {
228 return
229 }
230 t.FailNow()
231}
232
233// EqualExportedValuesf asserts that the types of two objects are equal and their public
234// fields are also equal. This is useful for comparing structs that have private fields
235// that could potentially differ.
236//
237// type S struct {
238// Exported int
239// notExported int
240// }
241// require.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true
242// require.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
243func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
244 if h, ok := t.(tHelper); ok {
245 h.Helper()
246 }
247 if assert.EqualExportedValuesf(t, expected, actual, msg, args...) {
248 return
249 }
250 t.FailNow()
251}
252
253// EqualValues asserts that two objects are equal or convertible to the larger
254// type and equal.
255//
256// require.EqualValues(t, uint32(123), int32(123))
amit.ghosh6ab2a982022-09-15 21:04:53 +0200257func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
258 if h, ok := t.(tHelper); ok {
259 h.Helper()
260 }
261 if assert.EqualValues(t, expected, actual, msgAndArgs...) {
262 return
263 }
264 t.FailNow()
265}
266
Abhay Kumar40252eb2025-10-13 13:25:53 +0000267// EqualValuesf asserts that two objects are equal or convertible to the larger
268// type and equal.
amit.ghosh6ab2a982022-09-15 21:04:53 +0200269//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000270// require.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200271func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
272 if h, ok := t.(tHelper); ok {
273 h.Helper()
274 }
275 if assert.EqualValuesf(t, expected, actual, msg, args...) {
276 return
277 }
278 t.FailNow()
279}
280
281// Equalf asserts that two objects are equal.
282//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000283// require.Equalf(t, 123, 123, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200284//
285// Pointer variable equality is determined based on the equality of the
286// referenced values (as opposed to the memory addresses). Function equality
287// cannot be determined and will always fail.
288func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
289 if h, ok := t.(tHelper); ok {
290 h.Helper()
291 }
292 if assert.Equalf(t, expected, actual, msg, args...) {
293 return
294 }
295 t.FailNow()
296}
297
298// Error asserts that a function returned an error (i.e. not `nil`).
299//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000300// actualObj, err := SomeFunction()
301// require.Error(t, err)
amit.ghosh6ab2a982022-09-15 21:04:53 +0200302func Error(t TestingT, err error, msgAndArgs ...interface{}) {
303 if h, ok := t.(tHelper); ok {
304 h.Helper()
305 }
306 if assert.Error(t, err, msgAndArgs...) {
307 return
308 }
309 t.FailNow()
310}
311
312// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
313// This is a wrapper for errors.As.
314func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) {
315 if h, ok := t.(tHelper); ok {
316 h.Helper()
317 }
318 if assert.ErrorAs(t, err, target, msgAndArgs...) {
319 return
320 }
321 t.FailNow()
322}
323
324// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
325// This is a wrapper for errors.As.
326func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) {
327 if h, ok := t.(tHelper); ok {
328 h.Helper()
329 }
330 if assert.ErrorAsf(t, err, target, msg, args...) {
331 return
332 }
333 t.FailNow()
334}
335
Abhay Kumar40252eb2025-10-13 13:25:53 +0000336// ErrorContains asserts that a function returned an error (i.e. not `nil`)
337// and that the error contains the specified substring.
338//
339// actualObj, err := SomeFunction()
340// require.ErrorContains(t, err, expectedErrorSubString)
341func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) {
342 if h, ok := t.(tHelper); ok {
343 h.Helper()
344 }
345 if assert.ErrorContains(t, theError, contains, msgAndArgs...) {
346 return
347 }
348 t.FailNow()
349}
350
351// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
352// and that the error contains the specified substring.
353//
354// actualObj, err := SomeFunction()
355// require.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
356func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) {
357 if h, ok := t.(tHelper); ok {
358 h.Helper()
359 }
360 if assert.ErrorContainsf(t, theError, contains, msg, args...) {
361 return
362 }
363 t.FailNow()
364}
365
amit.ghosh6ab2a982022-09-15 21:04:53 +0200366// ErrorIs asserts that at least one of the errors in err's chain matches target.
367// This is a wrapper for errors.Is.
368func ErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) {
369 if h, ok := t.(tHelper); ok {
370 h.Helper()
371 }
372 if assert.ErrorIs(t, err, target, msgAndArgs...) {
373 return
374 }
375 t.FailNow()
376}
377
378// ErrorIsf asserts that at least one of the errors in err's chain matches target.
379// This is a wrapper for errors.Is.
380func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) {
381 if h, ok := t.(tHelper); ok {
382 h.Helper()
383 }
384 if assert.ErrorIsf(t, err, target, msg, args...) {
385 return
386 }
387 t.FailNow()
388}
389
390// Errorf asserts that a function returned an error (i.e. not `nil`).
391//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000392// actualObj, err := SomeFunction()
393// require.Errorf(t, err, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200394func Errorf(t TestingT, err error, msg string, args ...interface{}) {
395 if h, ok := t.(tHelper); ok {
396 h.Helper()
397 }
398 if assert.Errorf(t, err, msg, args...) {
399 return
400 }
401 t.FailNow()
402}
403
404// Eventually asserts that given condition will be met in waitFor time,
405// periodically checking target function each tick.
406//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000407// require.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond)
amit.ghosh6ab2a982022-09-15 21:04:53 +0200408func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
409 if h, ok := t.(tHelper); ok {
410 h.Helper()
411 }
412 if assert.Eventually(t, condition, waitFor, tick, msgAndArgs...) {
413 return
414 }
415 t.FailNow()
416}
417
Abhay Kumar40252eb2025-10-13 13:25:53 +0000418// EventuallyWithT asserts that given condition will be met in waitFor time,
419// periodically checking target function each tick. In contrast to Eventually,
420// it supplies a CollectT to the condition function, so that the condition
421// function can use the CollectT to call other assertions.
422// The condition is considered "met" if no errors are raised in a tick.
423// The supplied CollectT collects all errors from one tick (if there are any).
424// If the condition is not met before waitFor, the collected errors of
425// the last tick are copied to t.
426//
427// externalValue := false
428// go func() {
429// time.Sleep(8*time.Second)
430// externalValue = true
431// }()
432// require.EventuallyWithT(t, func(c *require.CollectT) {
433// // add assertions as needed; any assertion failure will fail the current tick
434// require.True(c, externalValue, "expected 'externalValue' to be true")
435// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
436func EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
437 if h, ok := t.(tHelper); ok {
438 h.Helper()
439 }
440 if assert.EventuallyWithT(t, condition, waitFor, tick, msgAndArgs...) {
441 return
442 }
443 t.FailNow()
444}
445
446// EventuallyWithTf asserts that given condition will be met in waitFor time,
447// periodically checking target function each tick. In contrast to Eventually,
448// it supplies a CollectT to the condition function, so that the condition
449// function can use the CollectT to call other assertions.
450// The condition is considered "met" if no errors are raised in a tick.
451// The supplied CollectT collects all errors from one tick (if there are any).
452// If the condition is not met before waitFor, the collected errors of
453// the last tick are copied to t.
454//
455// externalValue := false
456// go func() {
457// time.Sleep(8*time.Second)
458// externalValue = true
459// }()
460// require.EventuallyWithTf(t, func(c *require.CollectT, "error message %s", "formatted") {
461// // add assertions as needed; any assertion failure will fail the current tick
462// require.True(c, externalValue, "expected 'externalValue' to be true")
463// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
464func EventuallyWithTf(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
465 if h, ok := t.(tHelper); ok {
466 h.Helper()
467 }
468 if assert.EventuallyWithTf(t, condition, waitFor, tick, msg, args...) {
469 return
470 }
471 t.FailNow()
472}
473
amit.ghosh6ab2a982022-09-15 21:04:53 +0200474// Eventuallyf asserts that given condition will be met in waitFor time,
475// periodically checking target function each tick.
476//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000477// require.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200478func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
479 if h, ok := t.(tHelper); ok {
480 h.Helper()
481 }
482 if assert.Eventuallyf(t, condition, waitFor, tick, msg, args...) {
483 return
484 }
485 t.FailNow()
486}
487
488// Exactly asserts that two objects are equal in value and type.
489//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000490// require.Exactly(t, int32(123), int64(123))
amit.ghosh6ab2a982022-09-15 21:04:53 +0200491func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
492 if h, ok := t.(tHelper); ok {
493 h.Helper()
494 }
495 if assert.Exactly(t, expected, actual, msgAndArgs...) {
496 return
497 }
498 t.FailNow()
499}
500
501// Exactlyf asserts that two objects are equal in value and type.
502//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000503// require.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200504func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
505 if h, ok := t.(tHelper); ok {
506 h.Helper()
507 }
508 if assert.Exactlyf(t, expected, actual, msg, args...) {
509 return
510 }
511 t.FailNow()
512}
513
514// Fail reports a failure through
515func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
516 if h, ok := t.(tHelper); ok {
517 h.Helper()
518 }
519 if assert.Fail(t, failureMessage, msgAndArgs...) {
520 return
521 }
522 t.FailNow()
523}
524
525// FailNow fails test
526func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
527 if h, ok := t.(tHelper); ok {
528 h.Helper()
529 }
530 if assert.FailNow(t, failureMessage, msgAndArgs...) {
531 return
532 }
533 t.FailNow()
534}
535
536// FailNowf fails test
537func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {
538 if h, ok := t.(tHelper); ok {
539 h.Helper()
540 }
541 if assert.FailNowf(t, failureMessage, msg, args...) {
542 return
543 }
544 t.FailNow()
545}
546
547// Failf reports a failure through
548func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {
549 if h, ok := t.(tHelper); ok {
550 h.Helper()
551 }
552 if assert.Failf(t, failureMessage, msg, args...) {
553 return
554 }
555 t.FailNow()
556}
557
558// False asserts that the specified value is false.
559//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000560// require.False(t, myBool)
amit.ghosh6ab2a982022-09-15 21:04:53 +0200561func False(t TestingT, value bool, msgAndArgs ...interface{}) {
562 if h, ok := t.(tHelper); ok {
563 h.Helper()
564 }
565 if assert.False(t, value, msgAndArgs...) {
566 return
567 }
568 t.FailNow()
569}
570
571// Falsef asserts that the specified value is false.
572//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000573// require.Falsef(t, myBool, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200574func Falsef(t TestingT, value bool, msg string, args ...interface{}) {
575 if h, ok := t.(tHelper); ok {
576 h.Helper()
577 }
578 if assert.Falsef(t, value, msg, args...) {
579 return
580 }
581 t.FailNow()
582}
583
584// FileExists checks whether a file exists in the given path. It also fails if
585// the path points to a directory or there is an error when trying to check the file.
586func FileExists(t TestingT, path string, msgAndArgs ...interface{}) {
587 if h, ok := t.(tHelper); ok {
588 h.Helper()
589 }
590 if assert.FileExists(t, path, msgAndArgs...) {
591 return
592 }
593 t.FailNow()
594}
595
596// FileExistsf checks whether a file exists in the given path. It also fails if
597// the path points to a directory or there is an error when trying to check the file.
598func FileExistsf(t TestingT, path string, msg string, args ...interface{}) {
599 if h, ok := t.(tHelper); ok {
600 h.Helper()
601 }
602 if assert.FileExistsf(t, path, msg, args...) {
603 return
604 }
605 t.FailNow()
606}
607
608// Greater asserts that the first element is greater than the second
609//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000610// require.Greater(t, 2, 1)
611// require.Greater(t, float64(2), float64(1))
612// require.Greater(t, "b", "a")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200613func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
614 if h, ok := t.(tHelper); ok {
615 h.Helper()
616 }
617 if assert.Greater(t, e1, e2, msgAndArgs...) {
618 return
619 }
620 t.FailNow()
621}
622
623// GreaterOrEqual asserts that the first element is greater than or equal to the second
624//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000625// require.GreaterOrEqual(t, 2, 1)
626// require.GreaterOrEqual(t, 2, 2)
627// require.GreaterOrEqual(t, "b", "a")
628// require.GreaterOrEqual(t, "b", "b")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200629func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
630 if h, ok := t.(tHelper); ok {
631 h.Helper()
632 }
633 if assert.GreaterOrEqual(t, e1, e2, msgAndArgs...) {
634 return
635 }
636 t.FailNow()
637}
638
639// GreaterOrEqualf asserts that the first element is greater than or equal to the second
640//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000641// require.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
642// require.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
643// require.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
644// require.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200645func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
646 if h, ok := t.(tHelper); ok {
647 h.Helper()
648 }
649 if assert.GreaterOrEqualf(t, e1, e2, msg, args...) {
650 return
651 }
652 t.FailNow()
653}
654
655// Greaterf asserts that the first element is greater than the second
656//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000657// require.Greaterf(t, 2, 1, "error message %s", "formatted")
658// require.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
659// require.Greaterf(t, "b", "a", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200660func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
661 if h, ok := t.(tHelper); ok {
662 h.Helper()
663 }
664 if assert.Greaterf(t, e1, e2, msg, args...) {
665 return
666 }
667 t.FailNow()
668}
669
670// HTTPBodyContains asserts that a specified handler returns a
671// body that contains a string.
672//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000673// require.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200674//
675// Returns whether the assertion was successful (true) or not (false).
676func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
677 if h, ok := t.(tHelper); ok {
678 h.Helper()
679 }
680 if assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {
681 return
682 }
683 t.FailNow()
684}
685
686// HTTPBodyContainsf asserts that a specified handler returns a
687// body that contains a string.
688//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000689// require.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200690//
691// Returns whether the assertion was successful (true) or not (false).
692func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
693 if h, ok := t.(tHelper); ok {
694 h.Helper()
695 }
696 if assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {
697 return
698 }
699 t.FailNow()
700}
701
702// HTTPBodyNotContains asserts that a specified handler returns a
703// body that does not contain a string.
704//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000705// require.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200706//
707// Returns whether the assertion was successful (true) or not (false).
708func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
709 if h, ok := t.(tHelper); ok {
710 h.Helper()
711 }
712 if assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) {
713 return
714 }
715 t.FailNow()
716}
717
718// HTTPBodyNotContainsf asserts that a specified handler returns a
719// body that does not contain a string.
720//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000721// require.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200722//
723// Returns whether the assertion was successful (true) or not (false).
724func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
725 if h, ok := t.(tHelper); ok {
726 h.Helper()
727 }
728 if assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) {
729 return
730 }
731 t.FailNow()
732}
733
734// HTTPError asserts that a specified handler returns an error status code.
735//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000736// require.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
amit.ghosh6ab2a982022-09-15 21:04:53 +0200737//
738// Returns whether the assertion was successful (true) or not (false).
739func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
740 if h, ok := t.(tHelper); ok {
741 h.Helper()
742 }
743 if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {
744 return
745 }
746 t.FailNow()
747}
748
749// HTTPErrorf asserts that a specified handler returns an error status code.
750//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000751// require.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
amit.ghosh6ab2a982022-09-15 21:04:53 +0200752//
753// Returns whether the assertion was successful (true) or not (false).
754func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
755 if h, ok := t.(tHelper); ok {
756 h.Helper()
757 }
758 if assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {
759 return
760 }
761 t.FailNow()
762}
763
764// HTTPRedirect asserts that a specified handler returns a redirect status code.
765//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000766// require.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
amit.ghosh6ab2a982022-09-15 21:04:53 +0200767//
768// Returns whether the assertion was successful (true) or not (false).
769func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
770 if h, ok := t.(tHelper); ok {
771 h.Helper()
772 }
773 if assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) {
774 return
775 }
776 t.FailNow()
777}
778
779// HTTPRedirectf asserts that a specified handler returns a redirect status code.
780//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000781// require.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
amit.ghosh6ab2a982022-09-15 21:04:53 +0200782//
783// Returns whether the assertion was successful (true) or not (false).
784func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
785 if h, ok := t.(tHelper); ok {
786 h.Helper()
787 }
788 if assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) {
789 return
790 }
791 t.FailNow()
792}
793
794// HTTPStatusCode asserts that a specified handler returns a specified status code.
795//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000796// require.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501)
amit.ghosh6ab2a982022-09-15 21:04:53 +0200797//
798// Returns whether the assertion was successful (true) or not (false).
799func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) {
800 if h, ok := t.(tHelper); ok {
801 h.Helper()
802 }
803 if assert.HTTPStatusCode(t, handler, method, url, values, statuscode, msgAndArgs...) {
804 return
805 }
806 t.FailNow()
807}
808
809// HTTPStatusCodef asserts that a specified handler returns a specified status code.
810//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000811// require.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200812//
813// Returns whether the assertion was successful (true) or not (false).
814func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) {
815 if h, ok := t.(tHelper); ok {
816 h.Helper()
817 }
818 if assert.HTTPStatusCodef(t, handler, method, url, values, statuscode, msg, args...) {
819 return
820 }
821 t.FailNow()
822}
823
824// HTTPSuccess asserts that a specified handler returns a success status code.
825//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000826// require.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
amit.ghosh6ab2a982022-09-15 21:04:53 +0200827//
828// Returns whether the assertion was successful (true) or not (false).
829func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
830 if h, ok := t.(tHelper); ok {
831 h.Helper()
832 }
833 if assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) {
834 return
835 }
836 t.FailNow()
837}
838
839// HTTPSuccessf asserts that a specified handler returns a success status code.
840//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000841// require.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200842//
843// Returns whether the assertion was successful (true) or not (false).
844func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
845 if h, ok := t.(tHelper); ok {
846 h.Helper()
847 }
848 if assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) {
849 return
850 }
851 t.FailNow()
852}
853
854// Implements asserts that an object is implemented by the specified interface.
855//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000856// require.Implements(t, (*MyInterface)(nil), new(MyObject))
amit.ghosh6ab2a982022-09-15 21:04:53 +0200857func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
858 if h, ok := t.(tHelper); ok {
859 h.Helper()
860 }
861 if assert.Implements(t, interfaceObject, object, msgAndArgs...) {
862 return
863 }
864 t.FailNow()
865}
866
867// Implementsf asserts that an object is implemented by the specified interface.
868//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000869// require.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200870func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
871 if h, ok := t.(tHelper); ok {
872 h.Helper()
873 }
874 if assert.Implementsf(t, interfaceObject, object, msg, args...) {
875 return
876 }
877 t.FailNow()
878}
879
880// InDelta asserts that the two numerals are within delta of each other.
881//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000882// require.InDelta(t, math.Pi, 22/7.0, 0.01)
amit.ghosh6ab2a982022-09-15 21:04:53 +0200883func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
884 if h, ok := t.(tHelper); ok {
885 h.Helper()
886 }
887 if assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
888 return
889 }
890 t.FailNow()
891}
892
893// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
894func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
895 if h, ok := t.(tHelper); ok {
896 h.Helper()
897 }
898 if assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) {
899 return
900 }
901 t.FailNow()
902}
903
904// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
905func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
906 if h, ok := t.(tHelper); ok {
907 h.Helper()
908 }
909 if assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {
910 return
911 }
912 t.FailNow()
913}
914
915// InDeltaSlice is the same as InDelta, except it compares two slices.
916func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
917 if h, ok := t.(tHelper); ok {
918 h.Helper()
919 }
920 if assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {
921 return
922 }
923 t.FailNow()
924}
925
926// InDeltaSlicef is the same as InDelta, except it compares two slices.
927func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
928 if h, ok := t.(tHelper); ok {
929 h.Helper()
930 }
931 if assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {
932 return
933 }
934 t.FailNow()
935}
936
937// InDeltaf asserts that the two numerals are within delta of each other.
938//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000939// require.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +0200940func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
941 if h, ok := t.(tHelper); ok {
942 h.Helper()
943 }
944 if assert.InDeltaf(t, expected, actual, delta, msg, args...) {
945 return
946 }
947 t.FailNow()
948}
949
950// InEpsilon asserts that expected and actual have a relative error less than epsilon
951func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
952 if h, ok := t.(tHelper); ok {
953 h.Helper()
954 }
955 if assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {
956 return
957 }
958 t.FailNow()
959}
960
961// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
962func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
963 if h, ok := t.(tHelper); ok {
964 h.Helper()
965 }
966 if assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) {
967 return
968 }
969 t.FailNow()
970}
971
972// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
973func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
974 if h, ok := t.(tHelper); ok {
975 h.Helper()
976 }
977 if assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {
978 return
979 }
980 t.FailNow()
981}
982
983// InEpsilonf asserts that expected and actual have a relative error less than epsilon
984func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
985 if h, ok := t.(tHelper); ok {
986 h.Helper()
987 }
988 if assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {
989 return
990 }
991 t.FailNow()
992}
993
994// IsDecreasing asserts that the collection is decreasing
995//
Abhay Kumar40252eb2025-10-13 13:25:53 +0000996// require.IsDecreasing(t, []int{2, 1, 0})
997// require.IsDecreasing(t, []float{2, 1})
998// require.IsDecreasing(t, []string{"b", "a"})
amit.ghosh6ab2a982022-09-15 21:04:53 +0200999func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {
1000 if h, ok := t.(tHelper); ok {
1001 h.Helper()
1002 }
1003 if assert.IsDecreasing(t, object, msgAndArgs...) {
1004 return
1005 }
1006 t.FailNow()
1007}
1008
1009// IsDecreasingf asserts that the collection is decreasing
1010//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001011// require.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted")
1012// require.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted")
1013// require.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001014func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {
1015 if h, ok := t.(tHelper); ok {
1016 h.Helper()
1017 }
1018 if assert.IsDecreasingf(t, object, msg, args...) {
1019 return
1020 }
1021 t.FailNow()
1022}
1023
1024// IsIncreasing asserts that the collection is increasing
1025//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001026// require.IsIncreasing(t, []int{1, 2, 3})
1027// require.IsIncreasing(t, []float{1, 2})
1028// require.IsIncreasing(t, []string{"a", "b"})
amit.ghosh6ab2a982022-09-15 21:04:53 +02001029func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {
1030 if h, ok := t.(tHelper); ok {
1031 h.Helper()
1032 }
1033 if assert.IsIncreasing(t, object, msgAndArgs...) {
1034 return
1035 }
1036 t.FailNow()
1037}
1038
1039// IsIncreasingf asserts that the collection is increasing
1040//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001041// require.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted")
1042// require.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted")
1043// require.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001044func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {
1045 if h, ok := t.(tHelper); ok {
1046 h.Helper()
1047 }
1048 if assert.IsIncreasingf(t, object, msg, args...) {
1049 return
1050 }
1051 t.FailNow()
1052}
1053
1054// IsNonDecreasing asserts that the collection is not decreasing
1055//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001056// require.IsNonDecreasing(t, []int{1, 1, 2})
1057// require.IsNonDecreasing(t, []float{1, 2})
1058// require.IsNonDecreasing(t, []string{"a", "b"})
amit.ghosh6ab2a982022-09-15 21:04:53 +02001059func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {
1060 if h, ok := t.(tHelper); ok {
1061 h.Helper()
1062 }
1063 if assert.IsNonDecreasing(t, object, msgAndArgs...) {
1064 return
1065 }
1066 t.FailNow()
1067}
1068
1069// IsNonDecreasingf asserts that the collection is not decreasing
1070//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001071// require.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted")
1072// require.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted")
1073// require.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001074func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {
1075 if h, ok := t.(tHelper); ok {
1076 h.Helper()
1077 }
1078 if assert.IsNonDecreasingf(t, object, msg, args...) {
1079 return
1080 }
1081 t.FailNow()
1082}
1083
1084// IsNonIncreasing asserts that the collection is not increasing
1085//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001086// require.IsNonIncreasing(t, []int{2, 1, 1})
1087// require.IsNonIncreasing(t, []float{2, 1})
1088// require.IsNonIncreasing(t, []string{"b", "a"})
amit.ghosh6ab2a982022-09-15 21:04:53 +02001089func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {
1090 if h, ok := t.(tHelper); ok {
1091 h.Helper()
1092 }
1093 if assert.IsNonIncreasing(t, object, msgAndArgs...) {
1094 return
1095 }
1096 t.FailNow()
1097}
1098
1099// IsNonIncreasingf asserts that the collection is not increasing
1100//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001101// require.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted")
1102// require.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted")
1103// require.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001104func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {
1105 if h, ok := t.(tHelper); ok {
1106 h.Helper()
1107 }
1108 if assert.IsNonIncreasingf(t, object, msg, args...) {
1109 return
1110 }
1111 t.FailNow()
1112}
1113
Abhay Kumar40252eb2025-10-13 13:25:53 +00001114// IsNotType asserts that the specified objects are not of the same type.
1115//
1116// require.IsNotType(t, &NotMyStruct{}, &MyStruct{})
1117func IsNotType(t TestingT, theType interface{}, object interface{}, msgAndArgs ...interface{}) {
1118 if h, ok := t.(tHelper); ok {
1119 h.Helper()
1120 }
1121 if assert.IsNotType(t, theType, object, msgAndArgs...) {
1122 return
1123 }
1124 t.FailNow()
1125}
1126
1127// IsNotTypef asserts that the specified objects are not of the same type.
1128//
1129// require.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted")
1130func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) {
1131 if h, ok := t.(tHelper); ok {
1132 h.Helper()
1133 }
1134 if assert.IsNotTypef(t, theType, object, msg, args...) {
1135 return
1136 }
1137 t.FailNow()
1138}
1139
amit.ghosh6ab2a982022-09-15 21:04:53 +02001140// IsType asserts that the specified objects are of the same type.
Abhay Kumar40252eb2025-10-13 13:25:53 +00001141//
1142// require.IsType(t, &MyStruct{}, &MyStruct{})
amit.ghosh6ab2a982022-09-15 21:04:53 +02001143func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
1144 if h, ok := t.(tHelper); ok {
1145 h.Helper()
1146 }
1147 if assert.IsType(t, expectedType, object, msgAndArgs...) {
1148 return
1149 }
1150 t.FailNow()
1151}
1152
1153// IsTypef asserts that the specified objects are of the same type.
Abhay Kumar40252eb2025-10-13 13:25:53 +00001154//
1155// require.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001156func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {
1157 if h, ok := t.(tHelper); ok {
1158 h.Helper()
1159 }
1160 if assert.IsTypef(t, expectedType, object, msg, args...) {
1161 return
1162 }
1163 t.FailNow()
1164}
1165
1166// JSONEq asserts that two JSON strings are equivalent.
1167//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001168// require.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001169func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
1170 if h, ok := t.(tHelper); ok {
1171 h.Helper()
1172 }
1173 if assert.JSONEq(t, expected, actual, msgAndArgs...) {
1174 return
1175 }
1176 t.FailNow()
1177}
1178
1179// JSONEqf asserts that two JSON strings are equivalent.
1180//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001181// require.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001182func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {
1183 if h, ok := t.(tHelper); ok {
1184 h.Helper()
1185 }
1186 if assert.JSONEqf(t, expected, actual, msg, args...) {
1187 return
1188 }
1189 t.FailNow()
1190}
1191
1192// Len asserts that the specified object has specific length.
1193// Len also fails if the object has a type that len() not accept.
1194//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001195// require.Len(t, mySlice, 3)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001196func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {
1197 if h, ok := t.(tHelper); ok {
1198 h.Helper()
1199 }
1200 if assert.Len(t, object, length, msgAndArgs...) {
1201 return
1202 }
1203 t.FailNow()
1204}
1205
1206// Lenf asserts that the specified object has specific length.
1207// Lenf also fails if the object has a type that len() not accept.
1208//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001209// require.Lenf(t, mySlice, 3, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001210func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {
1211 if h, ok := t.(tHelper); ok {
1212 h.Helper()
1213 }
1214 if assert.Lenf(t, object, length, msg, args...) {
1215 return
1216 }
1217 t.FailNow()
1218}
1219
1220// Less asserts that the first element is less than the second
1221//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001222// require.Less(t, 1, 2)
1223// require.Less(t, float64(1), float64(2))
1224// require.Less(t, "a", "b")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001225func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
1226 if h, ok := t.(tHelper); ok {
1227 h.Helper()
1228 }
1229 if assert.Less(t, e1, e2, msgAndArgs...) {
1230 return
1231 }
1232 t.FailNow()
1233}
1234
1235// LessOrEqual asserts that the first element is less than or equal to the second
1236//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001237// require.LessOrEqual(t, 1, 2)
1238// require.LessOrEqual(t, 2, 2)
1239// require.LessOrEqual(t, "a", "b")
1240// require.LessOrEqual(t, "b", "b")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001241func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
1242 if h, ok := t.(tHelper); ok {
1243 h.Helper()
1244 }
1245 if assert.LessOrEqual(t, e1, e2, msgAndArgs...) {
1246 return
1247 }
1248 t.FailNow()
1249}
1250
1251// LessOrEqualf asserts that the first element is less than or equal to the second
1252//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001253// require.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
1254// require.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
1255// require.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
1256// require.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001257func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
1258 if h, ok := t.(tHelper); ok {
1259 h.Helper()
1260 }
1261 if assert.LessOrEqualf(t, e1, e2, msg, args...) {
1262 return
1263 }
1264 t.FailNow()
1265}
1266
1267// Lessf asserts that the first element is less than the second
1268//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001269// require.Lessf(t, 1, 2, "error message %s", "formatted")
1270// require.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
1271// require.Lessf(t, "a", "b", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001272func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
1273 if h, ok := t.(tHelper); ok {
1274 h.Helper()
1275 }
1276 if assert.Lessf(t, e1, e2, msg, args...) {
1277 return
1278 }
1279 t.FailNow()
1280}
1281
1282// Negative asserts that the specified element is negative
1283//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001284// require.Negative(t, -1)
1285// require.Negative(t, -1.23)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001286func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) {
1287 if h, ok := t.(tHelper); ok {
1288 h.Helper()
1289 }
1290 if assert.Negative(t, e, msgAndArgs...) {
1291 return
1292 }
1293 t.FailNow()
1294}
1295
1296// Negativef asserts that the specified element is negative
1297//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001298// require.Negativef(t, -1, "error message %s", "formatted")
1299// require.Negativef(t, -1.23, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001300func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) {
1301 if h, ok := t.(tHelper); ok {
1302 h.Helper()
1303 }
1304 if assert.Negativef(t, e, msg, args...) {
1305 return
1306 }
1307 t.FailNow()
1308}
1309
1310// Never asserts that the given condition doesn't satisfy in waitFor time,
1311// periodically checking the target function each tick.
1312//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001313// require.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001314func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
1315 if h, ok := t.(tHelper); ok {
1316 h.Helper()
1317 }
1318 if assert.Never(t, condition, waitFor, tick, msgAndArgs...) {
1319 return
1320 }
1321 t.FailNow()
1322}
1323
1324// Neverf asserts that the given condition doesn't satisfy in waitFor time,
1325// periodically checking the target function each tick.
1326//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001327// require.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001328func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
1329 if h, ok := t.(tHelper); ok {
1330 h.Helper()
1331 }
1332 if assert.Neverf(t, condition, waitFor, tick, msg, args...) {
1333 return
1334 }
1335 t.FailNow()
1336}
1337
1338// Nil asserts that the specified object is nil.
1339//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001340// require.Nil(t, err)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001341func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
1342 if h, ok := t.(tHelper); ok {
1343 h.Helper()
1344 }
1345 if assert.Nil(t, object, msgAndArgs...) {
1346 return
1347 }
1348 t.FailNow()
1349}
1350
1351// Nilf asserts that the specified object is nil.
1352//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001353// require.Nilf(t, err, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001354func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {
1355 if h, ok := t.(tHelper); ok {
1356 h.Helper()
1357 }
1358 if assert.Nilf(t, object, msg, args...) {
1359 return
1360 }
1361 t.FailNow()
1362}
1363
1364// NoDirExists checks whether a directory does not exist in the given path.
1365// It fails if the path points to an existing _directory_ only.
1366func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) {
1367 if h, ok := t.(tHelper); ok {
1368 h.Helper()
1369 }
1370 if assert.NoDirExists(t, path, msgAndArgs...) {
1371 return
1372 }
1373 t.FailNow()
1374}
1375
1376// NoDirExistsf checks whether a directory does not exist in the given path.
1377// It fails if the path points to an existing _directory_ only.
1378func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) {
1379 if h, ok := t.(tHelper); ok {
1380 h.Helper()
1381 }
1382 if assert.NoDirExistsf(t, path, msg, args...) {
1383 return
1384 }
1385 t.FailNow()
1386}
1387
1388// NoError asserts that a function returned no error (i.e. `nil`).
1389//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001390// actualObj, err := SomeFunction()
1391// if require.NoError(t, err) {
1392// require.Equal(t, expectedObj, actualObj)
1393// }
amit.ghosh6ab2a982022-09-15 21:04:53 +02001394func NoError(t TestingT, err error, msgAndArgs ...interface{}) {
1395 if h, ok := t.(tHelper); ok {
1396 h.Helper()
1397 }
1398 if assert.NoError(t, err, msgAndArgs...) {
1399 return
1400 }
1401 t.FailNow()
1402}
1403
1404// NoErrorf asserts that a function returned no error (i.e. `nil`).
1405//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001406// actualObj, err := SomeFunction()
1407// if require.NoErrorf(t, err, "error message %s", "formatted") {
1408// require.Equal(t, expectedObj, actualObj)
1409// }
amit.ghosh6ab2a982022-09-15 21:04:53 +02001410func NoErrorf(t TestingT, err error, msg string, args ...interface{}) {
1411 if h, ok := t.(tHelper); ok {
1412 h.Helper()
1413 }
1414 if assert.NoErrorf(t, err, msg, args...) {
1415 return
1416 }
1417 t.FailNow()
1418}
1419
1420// NoFileExists checks whether a file does not exist in a given path. It fails
1421// if the path points to an existing _file_ only.
1422func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) {
1423 if h, ok := t.(tHelper); ok {
1424 h.Helper()
1425 }
1426 if assert.NoFileExists(t, path, msgAndArgs...) {
1427 return
1428 }
1429 t.FailNow()
1430}
1431
1432// NoFileExistsf checks whether a file does not exist in a given path. It fails
1433// if the path points to an existing _file_ only.
1434func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) {
1435 if h, ok := t.(tHelper); ok {
1436 h.Helper()
1437 }
1438 if assert.NoFileExistsf(t, path, msg, args...) {
1439 return
1440 }
1441 t.FailNow()
1442}
1443
1444// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
1445// specified substring or element.
1446//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001447// require.NotContains(t, "Hello World", "Earth")
1448// require.NotContains(t, ["Hello", "World"], "Earth")
1449// require.NotContains(t, {"Hello": "World"}, "Earth")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001450func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
1451 if h, ok := t.(tHelper); ok {
1452 h.Helper()
1453 }
1454 if assert.NotContains(t, s, contains, msgAndArgs...) {
1455 return
1456 }
1457 t.FailNow()
1458}
1459
1460// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
1461// specified substring or element.
1462//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001463// require.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
1464// require.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
1465// require.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001466func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
1467 if h, ok := t.(tHelper); ok {
1468 h.Helper()
1469 }
1470 if assert.NotContainsf(t, s, contains, msg, args...) {
1471 return
1472 }
1473 t.FailNow()
1474}
1475
Abhay Kumar40252eb2025-10-13 13:25:53 +00001476// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified
1477// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
1478// the number of appearances of each of them in both lists should not match.
1479// This is an inverse of ElementsMatch.
amit.ghosh6ab2a982022-09-15 21:04:53 +02001480//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001481// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false
1482//
1483// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true
1484//
1485// require.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true
1486func NotElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
1487 if h, ok := t.(tHelper); ok {
1488 h.Helper()
1489 }
1490 if assert.NotElementsMatch(t, listA, listB, msgAndArgs...) {
1491 return
1492 }
1493 t.FailNow()
1494}
1495
1496// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified
1497// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
1498// the number of appearances of each of them in both lists should not match.
1499// This is an inverse of ElementsMatch.
1500//
1501// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false
1502//
1503// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true
1504//
1505// require.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true
1506func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {
1507 if h, ok := t.(tHelper); ok {
1508 h.Helper()
1509 }
1510 if assert.NotElementsMatchf(t, listA, listB, msg, args...) {
1511 return
1512 }
1513 t.FailNow()
1514}
1515
1516// NotEmpty asserts that the specified object is NOT [Empty].
1517//
1518// if require.NotEmpty(t, obj) {
1519// require.Equal(t, "two", obj[1])
1520// }
amit.ghosh6ab2a982022-09-15 21:04:53 +02001521func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
1522 if h, ok := t.(tHelper); ok {
1523 h.Helper()
1524 }
1525 if assert.NotEmpty(t, object, msgAndArgs...) {
1526 return
1527 }
1528 t.FailNow()
1529}
1530
Abhay Kumar40252eb2025-10-13 13:25:53 +00001531// NotEmptyf asserts that the specified object is NOT [Empty].
amit.ghosh6ab2a982022-09-15 21:04:53 +02001532//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001533// if require.NotEmptyf(t, obj, "error message %s", "formatted") {
1534// require.Equal(t, "two", obj[1])
1535// }
amit.ghosh6ab2a982022-09-15 21:04:53 +02001536func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
1537 if h, ok := t.(tHelper); ok {
1538 h.Helper()
1539 }
1540 if assert.NotEmptyf(t, object, msg, args...) {
1541 return
1542 }
1543 t.FailNow()
1544}
1545
1546// NotEqual asserts that the specified values are NOT equal.
1547//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001548// require.NotEqual(t, obj1, obj2)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001549//
1550// Pointer variable equality is determined based on the equality of the
1551// referenced values (as opposed to the memory addresses).
1552func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
1553 if h, ok := t.(tHelper); ok {
1554 h.Helper()
1555 }
1556 if assert.NotEqual(t, expected, actual, msgAndArgs...) {
1557 return
1558 }
1559 t.FailNow()
1560}
1561
1562// NotEqualValues asserts that two objects are not equal even when converted to the same type
1563//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001564// require.NotEqualValues(t, obj1, obj2)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001565func NotEqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
1566 if h, ok := t.(tHelper); ok {
1567 h.Helper()
1568 }
1569 if assert.NotEqualValues(t, expected, actual, msgAndArgs...) {
1570 return
1571 }
1572 t.FailNow()
1573}
1574
1575// NotEqualValuesf asserts that two objects are not equal even when converted to the same type
1576//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001577// require.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001578func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
1579 if h, ok := t.(tHelper); ok {
1580 h.Helper()
1581 }
1582 if assert.NotEqualValuesf(t, expected, actual, msg, args...) {
1583 return
1584 }
1585 t.FailNow()
1586}
1587
1588// NotEqualf asserts that the specified values are NOT equal.
1589//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001590// require.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001591//
1592// Pointer variable equality is determined based on the equality of the
1593// referenced values (as opposed to the memory addresses).
1594func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
1595 if h, ok := t.(tHelper); ok {
1596 h.Helper()
1597 }
1598 if assert.NotEqualf(t, expected, actual, msg, args...) {
1599 return
1600 }
1601 t.FailNow()
1602}
1603
Abhay Kumar40252eb2025-10-13 13:25:53 +00001604// NotErrorAs asserts that none of the errors in err's chain matches target,
1605// but if so, sets target to that error value.
1606func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) {
1607 if h, ok := t.(tHelper); ok {
1608 h.Helper()
1609 }
1610 if assert.NotErrorAs(t, err, target, msgAndArgs...) {
1611 return
1612 }
1613 t.FailNow()
1614}
1615
1616// NotErrorAsf asserts that none of the errors in err's chain matches target,
1617// but if so, sets target to that error value.
1618func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) {
1619 if h, ok := t.(tHelper); ok {
1620 h.Helper()
1621 }
1622 if assert.NotErrorAsf(t, err, target, msg, args...) {
1623 return
1624 }
1625 t.FailNow()
1626}
1627
1628// NotErrorIs asserts that none of the errors in err's chain matches target.
amit.ghosh6ab2a982022-09-15 21:04:53 +02001629// This is a wrapper for errors.Is.
1630func NotErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) {
1631 if h, ok := t.(tHelper); ok {
1632 h.Helper()
1633 }
1634 if assert.NotErrorIs(t, err, target, msgAndArgs...) {
1635 return
1636 }
1637 t.FailNow()
1638}
1639
Abhay Kumar40252eb2025-10-13 13:25:53 +00001640// NotErrorIsf asserts that none of the errors in err's chain matches target.
amit.ghosh6ab2a982022-09-15 21:04:53 +02001641// This is a wrapper for errors.Is.
1642func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) {
1643 if h, ok := t.(tHelper); ok {
1644 h.Helper()
1645 }
1646 if assert.NotErrorIsf(t, err, target, msg, args...) {
1647 return
1648 }
1649 t.FailNow()
1650}
1651
Abhay Kumar40252eb2025-10-13 13:25:53 +00001652// NotImplements asserts that an object does not implement the specified interface.
1653//
1654// require.NotImplements(t, (*MyInterface)(nil), new(MyObject))
1655func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
1656 if h, ok := t.(tHelper); ok {
1657 h.Helper()
1658 }
1659 if assert.NotImplements(t, interfaceObject, object, msgAndArgs...) {
1660 return
1661 }
1662 t.FailNow()
1663}
1664
1665// NotImplementsf asserts that an object does not implement the specified interface.
1666//
1667// require.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
1668func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
1669 if h, ok := t.(tHelper); ok {
1670 h.Helper()
1671 }
1672 if assert.NotImplementsf(t, interfaceObject, object, msg, args...) {
1673 return
1674 }
1675 t.FailNow()
1676}
1677
amit.ghosh6ab2a982022-09-15 21:04:53 +02001678// NotNil asserts that the specified object is not nil.
1679//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001680// require.NotNil(t, err)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001681func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
1682 if h, ok := t.(tHelper); ok {
1683 h.Helper()
1684 }
1685 if assert.NotNil(t, object, msgAndArgs...) {
1686 return
1687 }
1688 t.FailNow()
1689}
1690
1691// NotNilf asserts that the specified object is not nil.
1692//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001693// require.NotNilf(t, err, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001694func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {
1695 if h, ok := t.(tHelper); ok {
1696 h.Helper()
1697 }
1698 if assert.NotNilf(t, object, msg, args...) {
1699 return
1700 }
1701 t.FailNow()
1702}
1703
1704// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
1705//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001706// require.NotPanics(t, func(){ RemainCalm() })
amit.ghosh6ab2a982022-09-15 21:04:53 +02001707func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
1708 if h, ok := t.(tHelper); ok {
1709 h.Helper()
1710 }
1711 if assert.NotPanics(t, f, msgAndArgs...) {
1712 return
1713 }
1714 t.FailNow()
1715}
1716
1717// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
1718//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001719// require.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001720func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
1721 if h, ok := t.(tHelper); ok {
1722 h.Helper()
1723 }
1724 if assert.NotPanicsf(t, f, msg, args...) {
1725 return
1726 }
1727 t.FailNow()
1728}
1729
1730// NotRegexp asserts that a specified regexp does not match a string.
1731//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001732// require.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
1733// require.NotRegexp(t, "^start", "it's not starting")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001734func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
1735 if h, ok := t.(tHelper); ok {
1736 h.Helper()
1737 }
1738 if assert.NotRegexp(t, rx, str, msgAndArgs...) {
1739 return
1740 }
1741 t.FailNow()
1742}
1743
1744// NotRegexpf asserts that a specified regexp does not match a string.
1745//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001746// require.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
1747// require.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001748func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
1749 if h, ok := t.(tHelper); ok {
1750 h.Helper()
1751 }
1752 if assert.NotRegexpf(t, rx, str, msg, args...) {
1753 return
1754 }
1755 t.FailNow()
1756}
1757
1758// NotSame asserts that two pointers do not reference the same object.
1759//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001760// require.NotSame(t, ptr1, ptr2)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001761//
1762// Both arguments must be pointer variables. Pointer variable sameness is
1763// determined based on the equality of both type and value.
1764func NotSame(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
1765 if h, ok := t.(tHelper); ok {
1766 h.Helper()
1767 }
1768 if assert.NotSame(t, expected, actual, msgAndArgs...) {
1769 return
1770 }
1771 t.FailNow()
1772}
1773
1774// NotSamef asserts that two pointers do not reference the same object.
1775//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001776// require.NotSamef(t, ptr1, ptr2, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001777//
1778// Both arguments must be pointer variables. Pointer variable sameness is
1779// determined based on the equality of both type and value.
1780func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
1781 if h, ok := t.(tHelper); ok {
1782 h.Helper()
1783 }
1784 if assert.NotSamef(t, expected, actual, msg, args...) {
1785 return
1786 }
1787 t.FailNow()
1788}
1789
Abhay Kumar40252eb2025-10-13 13:25:53 +00001790// NotSubset asserts that the list (array, slice, or map) does NOT contain all
1791// elements given in the subset (array, slice, or map).
1792// Map elements are key-value pairs unless compared with an array or slice where
1793// only the map key is evaluated.
amit.ghosh6ab2a982022-09-15 21:04:53 +02001794//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001795// require.NotSubset(t, [1, 3, 4], [1, 2])
1796// require.NotSubset(t, {"x": 1, "y": 2}, {"z": 3})
1797// require.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"})
1798// require.NotSubset(t, {"x": 1, "y": 2}, ["z"])
amit.ghosh6ab2a982022-09-15 21:04:53 +02001799func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
1800 if h, ok := t.(tHelper); ok {
1801 h.Helper()
1802 }
1803 if assert.NotSubset(t, list, subset, msgAndArgs...) {
1804 return
1805 }
1806 t.FailNow()
1807}
1808
Abhay Kumar40252eb2025-10-13 13:25:53 +00001809// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all
1810// elements given in the subset (array, slice, or map).
1811// Map elements are key-value pairs unless compared with an array or slice where
1812// only the map key is evaluated.
amit.ghosh6ab2a982022-09-15 21:04:53 +02001813//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001814// require.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted")
1815// require.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted")
1816// require.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted")
1817// require.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001818func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
1819 if h, ok := t.(tHelper); ok {
1820 h.Helper()
1821 }
1822 if assert.NotSubsetf(t, list, subset, msg, args...) {
1823 return
1824 }
1825 t.FailNow()
1826}
1827
1828// NotZero asserts that i is not the zero value for its type.
1829func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
1830 if h, ok := t.(tHelper); ok {
1831 h.Helper()
1832 }
1833 if assert.NotZero(t, i, msgAndArgs...) {
1834 return
1835 }
1836 t.FailNow()
1837}
1838
1839// NotZerof asserts that i is not the zero value for its type.
1840func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {
1841 if h, ok := t.(tHelper); ok {
1842 h.Helper()
1843 }
1844 if assert.NotZerof(t, i, msg, args...) {
1845 return
1846 }
1847 t.FailNow()
1848}
1849
1850// Panics asserts that the code inside the specified PanicTestFunc panics.
1851//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001852// require.Panics(t, func(){ GoCrazy() })
amit.ghosh6ab2a982022-09-15 21:04:53 +02001853func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
1854 if h, ok := t.(tHelper); ok {
1855 h.Helper()
1856 }
1857 if assert.Panics(t, f, msgAndArgs...) {
1858 return
1859 }
1860 t.FailNow()
1861}
1862
1863// PanicsWithError asserts that the code inside the specified PanicTestFunc
1864// panics, and that the recovered panic value is an error that satisfies the
1865// EqualError comparison.
1866//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001867// require.PanicsWithError(t, "crazy error", func(){ GoCrazy() })
amit.ghosh6ab2a982022-09-15 21:04:53 +02001868func PanicsWithError(t TestingT, errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
1869 if h, ok := t.(tHelper); ok {
1870 h.Helper()
1871 }
1872 if assert.PanicsWithError(t, errString, f, msgAndArgs...) {
1873 return
1874 }
1875 t.FailNow()
1876}
1877
1878// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
1879// panics, and that the recovered panic value is an error that satisfies the
1880// EqualError comparison.
1881//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001882// require.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001883func PanicsWithErrorf(t TestingT, errString string, f assert.PanicTestFunc, msg string, args ...interface{}) {
1884 if h, ok := t.(tHelper); ok {
1885 h.Helper()
1886 }
1887 if assert.PanicsWithErrorf(t, errString, f, msg, args...) {
1888 return
1889 }
1890 t.FailNow()
1891}
1892
1893// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
1894// the recovered panic value equals the expected panic value.
1895//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001896// require.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
amit.ghosh6ab2a982022-09-15 21:04:53 +02001897func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
1898 if h, ok := t.(tHelper); ok {
1899 h.Helper()
1900 }
1901 if assert.PanicsWithValue(t, expected, f, msgAndArgs...) {
1902 return
1903 }
1904 t.FailNow()
1905}
1906
1907// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
1908// the recovered panic value equals the expected panic value.
1909//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001910// require.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001911func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
1912 if h, ok := t.(tHelper); ok {
1913 h.Helper()
1914 }
1915 if assert.PanicsWithValuef(t, expected, f, msg, args...) {
1916 return
1917 }
1918 t.FailNow()
1919}
1920
1921// Panicsf asserts that the code inside the specified PanicTestFunc panics.
1922//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001923// require.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001924func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
1925 if h, ok := t.(tHelper); ok {
1926 h.Helper()
1927 }
1928 if assert.Panicsf(t, f, msg, args...) {
1929 return
1930 }
1931 t.FailNow()
1932}
1933
1934// Positive asserts that the specified element is positive
1935//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001936// require.Positive(t, 1)
1937// require.Positive(t, 1.23)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001938func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) {
1939 if h, ok := t.(tHelper); ok {
1940 h.Helper()
1941 }
1942 if assert.Positive(t, e, msgAndArgs...) {
1943 return
1944 }
1945 t.FailNow()
1946}
1947
1948// Positivef asserts that the specified element is positive
1949//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001950// require.Positivef(t, 1, "error message %s", "formatted")
1951// require.Positivef(t, 1.23, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001952func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) {
1953 if h, ok := t.(tHelper); ok {
1954 h.Helper()
1955 }
1956 if assert.Positivef(t, e, msg, args...) {
1957 return
1958 }
1959 t.FailNow()
1960}
1961
1962// Regexp asserts that a specified regexp matches a string.
1963//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001964// require.Regexp(t, regexp.MustCompile("start"), "it's starting")
1965// require.Regexp(t, "start...$", "it's not starting")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001966func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
1967 if h, ok := t.(tHelper); ok {
1968 h.Helper()
1969 }
1970 if assert.Regexp(t, rx, str, msgAndArgs...) {
1971 return
1972 }
1973 t.FailNow()
1974}
1975
1976// Regexpf asserts that a specified regexp matches a string.
1977//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001978// require.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
1979// require.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02001980func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
1981 if h, ok := t.(tHelper); ok {
1982 h.Helper()
1983 }
1984 if assert.Regexpf(t, rx, str, msg, args...) {
1985 return
1986 }
1987 t.FailNow()
1988}
1989
1990// Same asserts that two pointers reference the same object.
1991//
Abhay Kumar40252eb2025-10-13 13:25:53 +00001992// require.Same(t, ptr1, ptr2)
amit.ghosh6ab2a982022-09-15 21:04:53 +02001993//
1994// Both arguments must be pointer variables. Pointer variable sameness is
1995// determined based on the equality of both type and value.
1996func Same(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
1997 if h, ok := t.(tHelper); ok {
1998 h.Helper()
1999 }
2000 if assert.Same(t, expected, actual, msgAndArgs...) {
2001 return
2002 }
2003 t.FailNow()
2004}
2005
2006// Samef asserts that two pointers reference the same object.
2007//
Abhay Kumar40252eb2025-10-13 13:25:53 +00002008// require.Samef(t, ptr1, ptr2, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02002009//
2010// Both arguments must be pointer variables. Pointer variable sameness is
2011// determined based on the equality of both type and value.
2012func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
2013 if h, ok := t.(tHelper); ok {
2014 h.Helper()
2015 }
2016 if assert.Samef(t, expected, actual, msg, args...) {
2017 return
2018 }
2019 t.FailNow()
2020}
2021
Abhay Kumar40252eb2025-10-13 13:25:53 +00002022// Subset asserts that the list (array, slice, or map) contains all elements
2023// given in the subset (array, slice, or map).
2024// Map elements are key-value pairs unless compared with an array or slice where
2025// only the map key is evaluated.
amit.ghosh6ab2a982022-09-15 21:04:53 +02002026//
Abhay Kumar40252eb2025-10-13 13:25:53 +00002027// require.Subset(t, [1, 2, 3], [1, 2])
2028// require.Subset(t, {"x": 1, "y": 2}, {"x": 1})
2029// require.Subset(t, [1, 2, 3], {1: "one", 2: "two"})
2030// require.Subset(t, {"x": 1, "y": 2}, ["x"])
amit.ghosh6ab2a982022-09-15 21:04:53 +02002031func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
2032 if h, ok := t.(tHelper); ok {
2033 h.Helper()
2034 }
2035 if assert.Subset(t, list, subset, msgAndArgs...) {
2036 return
2037 }
2038 t.FailNow()
2039}
2040
Abhay Kumar40252eb2025-10-13 13:25:53 +00002041// Subsetf asserts that the list (array, slice, or map) contains all elements
2042// given in the subset (array, slice, or map).
2043// Map elements are key-value pairs unless compared with an array or slice where
2044// only the map key is evaluated.
amit.ghosh6ab2a982022-09-15 21:04:53 +02002045//
Abhay Kumar40252eb2025-10-13 13:25:53 +00002046// require.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted")
2047// require.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted")
2048// require.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted")
2049// require.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02002050func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
2051 if h, ok := t.(tHelper); ok {
2052 h.Helper()
2053 }
2054 if assert.Subsetf(t, list, subset, msg, args...) {
2055 return
2056 }
2057 t.FailNow()
2058}
2059
2060// True asserts that the specified value is true.
2061//
Abhay Kumar40252eb2025-10-13 13:25:53 +00002062// require.True(t, myBool)
amit.ghosh6ab2a982022-09-15 21:04:53 +02002063func True(t TestingT, value bool, msgAndArgs ...interface{}) {
2064 if h, ok := t.(tHelper); ok {
2065 h.Helper()
2066 }
2067 if assert.True(t, value, msgAndArgs...) {
2068 return
2069 }
2070 t.FailNow()
2071}
2072
2073// Truef asserts that the specified value is true.
2074//
Abhay Kumar40252eb2025-10-13 13:25:53 +00002075// require.Truef(t, myBool, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02002076func Truef(t TestingT, value bool, msg string, args ...interface{}) {
2077 if h, ok := t.(tHelper); ok {
2078 h.Helper()
2079 }
2080 if assert.Truef(t, value, msg, args...) {
2081 return
2082 }
2083 t.FailNow()
2084}
2085
2086// WithinDuration asserts that the two times are within duration delta of each other.
2087//
Abhay Kumar40252eb2025-10-13 13:25:53 +00002088// require.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
amit.ghosh6ab2a982022-09-15 21:04:53 +02002089func 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//
Abhay Kumar40252eb2025-10-13 13:25:53 +00002101// require.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
amit.ghosh6ab2a982022-09-15 21:04:53 +02002102func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
2103 if h, ok := t.(tHelper); ok {
2104 h.Helper()
2105 }
2106 if assert.WithinDurationf(t, expected, actual, delta, msg, args...) {
2107 return
2108 }
2109 t.FailNow()
2110}
2111
Abhay Kumar40252eb2025-10-13 13:25:53 +00002112// WithinRange asserts that a time is within a time range (inclusive).
2113//
2114// require.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))
2115func WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) {
2116 if h, ok := t.(tHelper); ok {
2117 h.Helper()
2118 }
2119 if assert.WithinRange(t, actual, start, end, msgAndArgs...) {
2120 return
2121 }
2122 t.FailNow()
2123}
2124
2125// WithinRangef asserts that a time is within a time range (inclusive).
2126//
2127// require.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
2128func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) {
2129 if h, ok := t.(tHelper); ok {
2130 h.Helper()
2131 }
2132 if assert.WithinRangef(t, actual, start, end, msg, args...) {
2133 return
2134 }
2135 t.FailNow()
2136}
2137
amit.ghosh6ab2a982022-09-15 21:04:53 +02002138// YAMLEq asserts that two YAML strings are equivalent.
2139func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
2140 if h, ok := t.(tHelper); ok {
2141 h.Helper()
2142 }
2143 if assert.YAMLEq(t, expected, actual, msgAndArgs...) {
2144 return
2145 }
2146 t.FailNow()
2147}
2148
2149// YAMLEqf asserts that two YAML strings are equivalent.
2150func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {
2151 if h, ok := t.(tHelper); ok {
2152 h.Helper()
2153 }
2154 if assert.YAMLEqf(t, expected, actual, msg, args...) {
2155 return
2156 }
2157 t.FailNow()
2158}
2159
2160// Zero asserts that i is the zero value for its type.
2161func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
2162 if h, ok := t.(tHelper); ok {
2163 h.Helper()
2164 }
2165 if assert.Zero(t, i, msgAndArgs...) {
2166 return
2167 }
2168 t.FailNow()
2169}
2170
2171// Zerof asserts that i is the zero value for its type.
2172func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {
2173 if h, ok := t.(tHelper); ok {
2174 h.Helper()
2175 }
2176 if assert.Zerof(t, i, msg, args...) {
2177 return
2178 }
2179 t.FailNow()
2180}