2 * CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
3 * THIS FILE MUST NOT BE EDITED BY HAND
9 assert "github.com/stretchr/testify/assert"
15 // Condition uses a Comparison to assert a complex condition.
16 func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) {
17 Condition(a.t, comp, msgAndArgs...)
20 // Conditionf uses a Comparison to assert a complex condition.
21 func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) {
22 Conditionf(a.t, comp, msg, args...)
25 // Contains asserts that the specified string, list(array, slice...) or map contains the
26 // specified substring or element.
28 // a.Contains("Hello World", "World")
29 // a.Contains(["Hello", "World"], "World")
30 // a.Contains({"Hello": "World"}, "Hello")
32 // Returns whether the assertion was successful (true) or not (false).
33 func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
34 Contains(a.t, s, contains, msgAndArgs...)
37 // Containsf asserts that the specified string, list(array, slice...) or map contains the
38 // specified substring or element.
40 // a.Containsf("Hello World", "World", "error message %s", "formatted")
41 // a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
42 // a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
44 // Returns whether the assertion was successful (true) or not (false).
45 func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
46 Containsf(a.t, s, contains, msg, args...)
49 // Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
50 // a slice or a channel with len == 0.
54 // Returns whether the assertion was successful (true) or not (false).
55 func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {
56 Empty(a.t, object, msgAndArgs...)
59 // Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
60 // a slice or a channel with len == 0.
62 // a.Emptyf(obj, "error message %s", "formatted")
64 // Returns whether the assertion was successful (true) or not (false).
65 func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) {
66 Emptyf(a.t, object, msg, args...)
69 // Equal asserts that two objects are equal.
73 // Returns whether the assertion was successful (true) or not (false).
75 // Pointer variable equality is determined based on the equality of the
76 // referenced values (as opposed to the memory addresses). Function equality
77 // cannot be determined and will always fail.
78 func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
79 Equal(a.t, expected, actual, msgAndArgs...)
82 // EqualError asserts that a function returned an error (i.e. not `nil`)
83 // and that it is equal to the provided error.
85 // actualObj, err := SomeFunction()
86 // a.EqualError(err, expectedErrorString)
88 // Returns whether the assertion was successful (true) or not (false).
89 func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {
90 EqualError(a.t, theError, errString, msgAndArgs...)
93 // EqualErrorf asserts that a function returned an error (i.e. not `nil`)
94 // and that it is equal to the provided error.
96 // actualObj, err := SomeFunction()
97 // a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
99 // Returns whether the assertion was successful (true) or not (false).
100 func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) {
101 EqualErrorf(a.t, theError, errString, msg, args...)
104 // EqualValues asserts that two objects are equal or convertable to the same types
107 // a.EqualValues(uint32(123), int32(123))
109 // Returns whether the assertion was successful (true) or not (false).
110 func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
111 EqualValues(a.t, expected, actual, msgAndArgs...)
114 // EqualValuesf asserts that two objects are equal or convertable to the same types
117 // a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
119 // Returns whether the assertion was successful (true) or not (false).
120 func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
121 EqualValuesf(a.t, expected, actual, msg, args...)
124 // Equalf asserts that two objects are equal.
126 // a.Equalf(123, 123, "error message %s", "formatted")
128 // Returns whether the assertion was successful (true) or not (false).
130 // Pointer variable equality is determined based on the equality of the
131 // referenced values (as opposed to the memory addresses). Function equality
132 // cannot be determined and will always fail.
133 func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
134 Equalf(a.t, expected, actual, msg, args...)
137 // Error asserts that a function returned an error (i.e. not `nil`).
139 // actualObj, err := SomeFunction()
141 // assert.Equal(t, expectedError, err)
144 // Returns whether the assertion was successful (true) or not (false).
145 func (a *Assertions) Error(err error, msgAndArgs ...interface{}) {
146 Error(a.t, err, msgAndArgs...)
149 // Errorf asserts that a function returned an error (i.e. not `nil`).
151 // actualObj, err := SomeFunction()
152 // if a.Errorf(err, "error message %s", "formatted") {
153 // assert.Equal(t, expectedErrorf, err)
156 // Returns whether the assertion was successful (true) or not (false).
157 func (a *Assertions) Errorf(err error, msg string, args ...interface{}) {
158 Errorf(a.t, err, msg, args...)
161 // Exactly asserts that two objects are equal is value and type.
163 // a.Exactly(int32(123), int64(123))
165 // Returns whether the assertion was successful (true) or not (false).
166 func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
167 Exactly(a.t, expected, actual, msgAndArgs...)
170 // Exactlyf asserts that two objects are equal is value and type.
172 // a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
174 // Returns whether the assertion was successful (true) or not (false).
175 func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
176 Exactlyf(a.t, expected, actual, msg, args...)
179 // Fail reports a failure through
180 func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {
181 Fail(a.t, failureMessage, msgAndArgs...)
184 // FailNow fails test
185 func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {
186 FailNow(a.t, failureMessage, msgAndArgs...)
189 // FailNowf fails test
190 func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) {
191 FailNowf(a.t, failureMessage, msg, args...)
194 // Failf reports a failure through
195 func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) {
196 Failf(a.t, failureMessage, msg, args...)
199 // False asserts that the specified value is false.
203 // Returns whether the assertion was successful (true) or not (false).
204 func (a *Assertions) False(value bool, msgAndArgs ...interface{}) {
205 False(a.t, value, msgAndArgs...)
208 // Falsef asserts that the specified value is false.
210 // a.Falsef(myBool, "error message %s", "formatted")
212 // Returns whether the assertion was successful (true) or not (false).
213 func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {
214 Falsef(a.t, value, msg, args...)
217 // HTTPBodyContains asserts that a specified handler returns a
218 // body that contains a string.
220 // a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
222 // Returns whether the assertion was successful (true) or not (false).
223 func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
224 HTTPBodyContains(a.t, handler, method, url, values, str)
227 // HTTPBodyContainsf asserts that a specified handler returns a
228 // body that contains a string.
230 // a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
232 // Returns whether the assertion was successful (true) or not (false).
233 func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
234 HTTPBodyContainsf(a.t, handler, method, url, values, str)
237 // HTTPBodyNotContains asserts that a specified handler returns a
238 // body that does not contain a string.
240 // a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
242 // Returns whether the assertion was successful (true) or not (false).
243 func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
244 HTTPBodyNotContains(a.t, handler, method, url, values, str)
247 // HTTPBodyNotContainsf asserts that a specified handler returns a
248 // body that does not contain a string.
250 // a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
252 // Returns whether the assertion was successful (true) or not (false).
253 func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
254 HTTPBodyNotContainsf(a.t, handler, method, url, values, str)
257 // HTTPError asserts that a specified handler returns an error status code.
259 // a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
261 // Returns whether the assertion was successful (true) or not (false).
262 func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) {
263 HTTPError(a.t, handler, method, url, values)
266 // HTTPErrorf asserts that a specified handler returns an error status code.
268 // a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
270 // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
271 func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values) {
272 HTTPErrorf(a.t, handler, method, url, values)
275 // HTTPRedirect asserts that a specified handler returns a redirect status code.
277 // a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
279 // Returns whether the assertion was successful (true) or not (false).
280 func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) {
281 HTTPRedirect(a.t, handler, method, url, values)
284 // HTTPRedirectf asserts that a specified handler returns a redirect status code.
286 // a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
288 // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
289 func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values) {
290 HTTPRedirectf(a.t, handler, method, url, values)
293 // HTTPSuccess asserts that a specified handler returns a success status code.
295 // a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
297 // Returns whether the assertion was successful (true) or not (false).
298 func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) {
299 HTTPSuccess(a.t, handler, method, url, values)
302 // HTTPSuccessf asserts that a specified handler returns a success status code.
304 // a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
306 // Returns whether the assertion was successful (true) or not (false).
307 func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values) {
308 HTTPSuccessf(a.t, handler, method, url, values)
311 // Implements asserts that an object is implemented by the specified interface.
313 // a.Implements((*MyInterface)(nil), new(MyObject))
314 func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
315 Implements(a.t, interfaceObject, object, msgAndArgs...)
318 // Implementsf asserts that an object is implemented by the specified interface.
320 // a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
321 func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
322 Implementsf(a.t, interfaceObject, object, msg, args...)
325 // InDelta asserts that the two numerals are within delta of each other.
327 // a.InDelta(math.Pi, (22 / 7.0), 0.01)
329 // Returns whether the assertion was successful (true) or not (false).
330 func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
331 InDelta(a.t, expected, actual, delta, msgAndArgs...)
334 // InDeltaSlice is the same as InDelta, except it compares two slices.
335 func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
336 InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
339 // InDeltaSlicef is the same as InDelta, except it compares two slices.
340 func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
341 InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
344 // InDeltaf asserts that the two numerals are within delta of each other.
346 // a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
348 // Returns whether the assertion was successful (true) or not (false).
349 func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
350 InDeltaf(a.t, expected, actual, delta, msg, args...)
353 // InEpsilon asserts that expected and actual have a relative error less than epsilon
355 // Returns whether the assertion was successful (true) or not (false).
356 func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
357 InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
360 // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
361 func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
362 InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
365 // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
366 func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
367 InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
370 // InEpsilonf asserts that expected and actual have a relative error less than epsilon
372 // Returns whether the assertion was successful (true) or not (false).
373 func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
374 InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
377 // IsType asserts that the specified objects are of the same type.
378 func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
379 IsType(a.t, expectedType, object, msgAndArgs...)
382 // IsTypef asserts that the specified objects are of the same type.
383 func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) {
384 IsTypef(a.t, expectedType, object, msg, args...)
387 // JSONEq asserts that two JSON strings are equivalent.
389 // a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
391 // Returns whether the assertion was successful (true) or not (false).
392 func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {
393 JSONEq(a.t, expected, actual, msgAndArgs...)
396 // JSONEqf asserts that two JSON strings are equivalent.
398 // a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
400 // Returns whether the assertion was successful (true) or not (false).
401 func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) {
402 JSONEqf(a.t, expected, actual, msg, args...)
405 // Len asserts that the specified object has specific length.
406 // Len also fails if the object has a type that len() not accept.
410 // Returns whether the assertion was successful (true) or not (false).
411 func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {
412 Len(a.t, object, length, msgAndArgs...)
415 // Lenf asserts that the specified object has specific length.
416 // Lenf also fails if the object has a type that len() not accept.
418 // a.Lenf(mySlice, 3, "error message %s", "formatted")
420 // Returns whether the assertion was successful (true) or not (false).
421 func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) {
422 Lenf(a.t, object, length, msg, args...)
425 // Nil asserts that the specified object is nil.
429 // Returns whether the assertion was successful (true) or not (false).
430 func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {
431 Nil(a.t, object, msgAndArgs...)
434 // Nilf asserts that the specified object is nil.
436 // a.Nilf(err, "error message %s", "formatted")
438 // Returns whether the assertion was successful (true) or not (false).
439 func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {
440 Nilf(a.t, object, msg, args...)
443 // NoError asserts that a function returned no error (i.e. `nil`).
445 // actualObj, err := SomeFunction()
446 // if a.NoError(err) {
447 // assert.Equal(t, expectedObj, actualObj)
450 // Returns whether the assertion was successful (true) or not (false).
451 func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {
452 NoError(a.t, err, msgAndArgs...)
455 // NoErrorf asserts that a function returned no error (i.e. `nil`).
457 // actualObj, err := SomeFunction()
458 // if a.NoErrorf(err, "error message %s", "formatted") {
459 // assert.Equal(t, expectedObj, actualObj)
462 // Returns whether the assertion was successful (true) or not (false).
463 func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {
464 NoErrorf(a.t, err, msg, args...)
467 // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
468 // specified substring or element.
470 // a.NotContains("Hello World", "Earth")
471 // a.NotContains(["Hello", "World"], "Earth")
472 // a.NotContains({"Hello": "World"}, "Earth")
474 // Returns whether the assertion was successful (true) or not (false).
475 func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
476 NotContains(a.t, s, contains, msgAndArgs...)
479 // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
480 // specified substring or element.
482 // a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
483 // a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
484 // a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
486 // Returns whether the assertion was successful (true) or not (false).
487 func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
488 NotContainsf(a.t, s, contains, msg, args...)
491 // NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
492 // a slice or a channel with len == 0.
494 // if a.NotEmpty(obj) {
495 // assert.Equal(t, "two", obj[1])
498 // Returns whether the assertion was successful (true) or not (false).
499 func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {
500 NotEmpty(a.t, object, msgAndArgs...)
503 // NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
504 // a slice or a channel with len == 0.
506 // if a.NotEmptyf(obj, "error message %s", "formatted") {
507 // assert.Equal(t, "two", obj[1])
510 // Returns whether the assertion was successful (true) or not (false).
511 func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) {
512 NotEmptyf(a.t, object, msg, args...)
515 // NotEqual asserts that the specified values are NOT equal.
517 // a.NotEqual(obj1, obj2)
519 // Returns whether the assertion was successful (true) or not (false).
521 // Pointer variable equality is determined based on the equality of the
522 // referenced values (as opposed to the memory addresses).
523 func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
524 NotEqual(a.t, expected, actual, msgAndArgs...)
527 // NotEqualf asserts that the specified values are NOT equal.
529 // a.NotEqualf(obj1, obj2, "error message %s", "formatted")
531 // Returns whether the assertion was successful (true) or not (false).
533 // Pointer variable equality is determined based on the equality of the
534 // referenced values (as opposed to the memory addresses).
535 func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
536 NotEqualf(a.t, expected, actual, msg, args...)
539 // NotNil asserts that the specified object is not nil.
543 // Returns whether the assertion was successful (true) or not (false).
544 func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {
545 NotNil(a.t, object, msgAndArgs...)
548 // NotNilf asserts that the specified object is not nil.
550 // a.NotNilf(err, "error message %s", "formatted")
552 // Returns whether the assertion was successful (true) or not (false).
553 func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) {
554 NotNilf(a.t, object, msg, args...)
557 // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
559 // a.NotPanics(func(){ RemainCalm() })
561 // Returns whether the assertion was successful (true) or not (false).
562 func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
563 NotPanics(a.t, f, msgAndArgs...)
566 // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
568 // a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
570 // Returns whether the assertion was successful (true) or not (false).
571 func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
572 NotPanicsf(a.t, f, msg, args...)
575 // NotRegexp asserts that a specified regexp does not match a string.
577 // a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
578 // a.NotRegexp("^start", "it's not starting")
580 // Returns whether the assertion was successful (true) or not (false).
581 func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
582 NotRegexp(a.t, rx, str, msgAndArgs...)
585 // NotRegexpf asserts that a specified regexp does not match a string.
587 // a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
588 // a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
590 // Returns whether the assertion was successful (true) or not (false).
591 func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
592 NotRegexpf(a.t, rx, str, msg, args...)
595 // NotSubset asserts that the specified list(array, slice...) contains not all
596 // elements given in the specified subset(array, slice...).
598 // a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
600 // Returns whether the assertion was successful (true) or not (false).
601 func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
602 NotSubset(a.t, list, subset, msgAndArgs...)
605 // NotSubsetf asserts that the specified list(array, slice...) contains not all
606 // elements given in the specified subset(array, slice...).
608 // a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
610 // Returns whether the assertion was successful (true) or not (false).
611 func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
612 NotSubsetf(a.t, list, subset, msg, args...)
615 // NotZero asserts that i is not the zero value for its type and returns the truth.
616 func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {
617 NotZero(a.t, i, msgAndArgs...)
620 // NotZerof asserts that i is not the zero value for its type and returns the truth.
621 func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) {
622 NotZerof(a.t, i, msg, args...)
625 // Panics asserts that the code inside the specified PanicTestFunc panics.
627 // a.Panics(func(){ GoCrazy() })
629 // Returns whether the assertion was successful (true) or not (false).
630 func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
631 Panics(a.t, f, msgAndArgs...)
634 // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
635 // the recovered panic value equals the expected panic value.
637 // a.PanicsWithValue("crazy error", func(){ GoCrazy() })
639 // Returns whether the assertion was successful (true) or not (false).
640 func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
641 PanicsWithValue(a.t, expected, f, msgAndArgs...)
644 // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
645 // the recovered panic value equals the expected panic value.
647 // a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
649 // Returns whether the assertion was successful (true) or not (false).
650 func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
651 PanicsWithValuef(a.t, expected, f, msg, args...)
654 // Panicsf asserts that the code inside the specified PanicTestFunc panics.
656 // a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
658 // Returns whether the assertion was successful (true) or not (false).
659 func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
660 Panicsf(a.t, f, msg, args...)
663 // Regexp asserts that a specified regexp matches a string.
665 // a.Regexp(regexp.MustCompile("start"), "it's starting")
666 // a.Regexp("start...$", "it's not starting")
668 // Returns whether the assertion was successful (true) or not (false).
669 func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
670 Regexp(a.t, rx, str, msgAndArgs...)
673 // Regexpf asserts that a specified regexp matches a string.
675 // a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
676 // a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
678 // Returns whether the assertion was successful (true) or not (false).
679 func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
680 Regexpf(a.t, rx, str, msg, args...)
683 // Subset asserts that the specified list(array, slice...) contains all
684 // elements given in the specified subset(array, slice...).
686 // a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
688 // Returns whether the assertion was successful (true) or not (false).
689 func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
690 Subset(a.t, list, subset, msgAndArgs...)
693 // Subsetf asserts that the specified list(array, slice...) contains all
694 // elements given in the specified subset(array, slice...).
696 // a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
698 // Returns whether the assertion was successful (true) or not (false).
699 func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
700 Subsetf(a.t, list, subset, msg, args...)
703 // True asserts that the specified value is true.
707 // Returns whether the assertion was successful (true) or not (false).
708 func (a *Assertions) True(value bool, msgAndArgs ...interface{}) {
709 True(a.t, value, msgAndArgs...)
712 // Truef asserts that the specified value is true.
714 // a.Truef(myBool, "error message %s", "formatted")
716 // Returns whether the assertion was successful (true) or not (false).
717 func (a *Assertions) Truef(value bool, msg string, args ...interface{}) {
718 Truef(a.t, value, msg, args...)
721 // WithinDuration asserts that the two times are within duration delta of each other.
723 // a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
725 // Returns whether the assertion was successful (true) or not (false).
726 func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
727 WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
730 // WithinDurationf asserts that the two times are within duration delta of each other.
732 // a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
734 // Returns whether the assertion was successful (true) or not (false).
735 func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
736 WithinDurationf(a.t, expected, actual, delta, msg, args...)
739 // Zero asserts that i is the zero value for its type and returns the truth.
740 func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {
741 Zero(a.t, i, msgAndArgs...)
744 // Zerof asserts that i is the zero value for its type and returns the truth.
745 func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) {
746 Zerof(a.t, i, msg, args...)