2 * CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
3 * THIS FILE MUST NOT BE EDITED BY HAND
14 // Condition uses a Comparison to assert a complex condition.
15 func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool {
16 return Condition(a.t, comp, msgAndArgs...)
19 // Conditionf uses a Comparison to assert a complex condition.
20 func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool {
21 return Conditionf(a.t, comp, msg, args...)
24 // Contains asserts that the specified string, list(array, slice...) or map contains the
25 // specified substring or element.
27 // a.Contains("Hello World", "World")
28 // a.Contains(["Hello", "World"], "World")
29 // a.Contains({"Hello": "World"}, "Hello")
31 // Returns whether the assertion was successful (true) or not (false).
32 func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
33 return Contains(a.t, s, contains, msgAndArgs...)
36 // Containsf asserts that the specified string, list(array, slice...) or map contains the
37 // specified substring or element.
39 // a.Containsf("Hello World", "World", "error message %s", "formatted")
40 // a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
41 // a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
43 // Returns whether the assertion was successful (true) or not (false).
44 func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
45 return Containsf(a.t, s, contains, msg, args...)
48 // Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
49 // a slice or a channel with len == 0.
53 // Returns whether the assertion was successful (true) or not (false).
54 func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {
55 return Empty(a.t, object, msgAndArgs...)
58 // Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
59 // a slice or a channel with len == 0.
61 // a.Emptyf(obj, "error message %s", "formatted")
63 // Returns whether the assertion was successful (true) or not (false).
64 func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {
65 return Emptyf(a.t, object, msg, args...)
68 // Equal asserts that two objects are equal.
72 // Returns whether the assertion was successful (true) or not (false).
74 // Pointer variable equality is determined based on the equality of the
75 // referenced values (as opposed to the memory addresses). Function equality
76 // cannot be determined and will always fail.
77 func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
78 return Equal(a.t, expected, actual, msgAndArgs...)
81 // EqualError asserts that a function returned an error (i.e. not `nil`)
82 // and that it is equal to the provided error.
84 // actualObj, err := SomeFunction()
85 // a.EqualError(err, expectedErrorString)
87 // Returns whether the assertion was successful (true) or not (false).
88 func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {
89 return EqualError(a.t, theError, errString, msgAndArgs...)
92 // EqualErrorf asserts that a function returned an error (i.e. not `nil`)
93 // and that it is equal to the provided error.
95 // actualObj, err := SomeFunction()
96 // a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
98 // Returns whether the assertion was successful (true) or not (false).
99 func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {
100 return EqualErrorf(a.t, theError, errString, msg, args...)
103 // EqualValues asserts that two objects are equal or convertable to the same types
106 // a.EqualValues(uint32(123), int32(123))
108 // Returns whether the assertion was successful (true) or not (false).
109 func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
110 return EqualValues(a.t, expected, actual, msgAndArgs...)
113 // EqualValuesf asserts that two objects are equal or convertable to the same types
116 // a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
118 // Returns whether the assertion was successful (true) or not (false).
119 func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
120 return EqualValuesf(a.t, expected, actual, msg, args...)
123 // Equalf asserts that two objects are equal.
125 // a.Equalf(123, 123, "error message %s", "formatted")
127 // Returns whether the assertion was successful (true) or not (false).
129 // Pointer variable equality is determined based on the equality of the
130 // referenced values (as opposed to the memory addresses). Function equality
131 // cannot be determined and will always fail.
132 func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
133 return Equalf(a.t, expected, actual, msg, args...)
136 // Error asserts that a function returned an error (i.e. not `nil`).
138 // actualObj, err := SomeFunction()
140 // assert.Equal(t, expectedError, err)
143 // Returns whether the assertion was successful (true) or not (false).
144 func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
145 return Error(a.t, err, msgAndArgs...)
148 // Errorf asserts that a function returned an error (i.e. not `nil`).
150 // actualObj, err := SomeFunction()
151 // if a.Errorf(err, "error message %s", "formatted") {
152 // assert.Equal(t, expectedErrorf, err)
155 // Returns whether the assertion was successful (true) or not (false).
156 func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {
157 return Errorf(a.t, err, msg, args...)
160 // Exactly asserts that two objects are equal is value and type.
162 // a.Exactly(int32(123), int64(123))
164 // Returns whether the assertion was successful (true) or not (false).
165 func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
166 return Exactly(a.t, expected, actual, msgAndArgs...)
169 // Exactlyf asserts that two objects are equal is value and type.
171 // a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
173 // Returns whether the assertion was successful (true) or not (false).
174 func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
175 return Exactlyf(a.t, expected, actual, msg, args...)
178 // Fail reports a failure through
179 func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool {
180 return Fail(a.t, failureMessage, msgAndArgs...)
183 // FailNow fails test
184 func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool {
185 return FailNow(a.t, failureMessage, msgAndArgs...)
188 // FailNowf fails test
189 func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool {
190 return FailNowf(a.t, failureMessage, msg, args...)
193 // Failf reports a failure through
194 func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool {
195 return Failf(a.t, failureMessage, msg, args...)
198 // False asserts that the specified value is false.
202 // Returns whether the assertion was successful (true) or not (false).
203 func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
204 return False(a.t, value, msgAndArgs...)
207 // Falsef asserts that the specified value is false.
209 // a.Falsef(myBool, "error message %s", "formatted")
211 // Returns whether the assertion was successful (true) or not (false).
212 func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {
213 return Falsef(a.t, value, msg, args...)
216 // HTTPBodyContains asserts that a specified handler returns a
217 // body that contains a string.
219 // a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
221 // Returns whether the assertion was successful (true) or not (false).
222 func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool {
223 return HTTPBodyContains(a.t, handler, method, url, values, str)
226 // HTTPBodyContainsf asserts that a specified handler returns a
227 // body that contains a string.
229 // a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
231 // Returns whether the assertion was successful (true) or not (false).
232 func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool {
233 return HTTPBodyContainsf(a.t, handler, method, url, values, str)
236 // HTTPBodyNotContains asserts that a specified handler returns a
237 // body that does not contain a string.
239 // a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
241 // Returns whether the assertion was successful (true) or not (false).
242 func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool {
243 return HTTPBodyNotContains(a.t, handler, method, url, values, str)
246 // HTTPBodyNotContainsf asserts that a specified handler returns a
247 // body that does not contain a string.
249 // a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
251 // Returns whether the assertion was successful (true) or not (false).
252 func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool {
253 return HTTPBodyNotContainsf(a.t, handler, method, url, values, str)
256 // HTTPError asserts that a specified handler returns an error status code.
258 // a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
260 // Returns whether the assertion was successful (true) or not (false).
261 func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) bool {
262 return HTTPError(a.t, handler, method, url, values)
265 // HTTPErrorf asserts that a specified handler returns an error status code.
267 // a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
269 // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
270 func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values) bool {
271 return HTTPErrorf(a.t, handler, method, url, values)
274 // HTTPRedirect asserts that a specified handler returns a redirect status code.
276 // a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
278 // Returns whether the assertion was successful (true) or not (false).
279 func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) bool {
280 return HTTPRedirect(a.t, handler, method, url, values)
283 // HTTPRedirectf asserts that a specified handler returns a redirect status code.
285 // a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
287 // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
288 func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values) bool {
289 return HTTPRedirectf(a.t, handler, method, url, values)
292 // HTTPSuccess asserts that a specified handler returns a success status code.
294 // a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
296 // Returns whether the assertion was successful (true) or not (false).
297 func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) bool {
298 return HTTPSuccess(a.t, handler, method, url, values)
301 // HTTPSuccessf asserts that a specified handler returns a success status code.
303 // a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
305 // Returns whether the assertion was successful (true) or not (false).
306 func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values) bool {
307 return HTTPSuccessf(a.t, handler, method, url, values)
310 // Implements asserts that an object is implemented by the specified interface.
312 // a.Implements((*MyInterface)(nil), new(MyObject))
313 func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
314 return Implements(a.t, interfaceObject, object, msgAndArgs...)
317 // Implementsf asserts that an object is implemented by the specified interface.
319 // a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
320 func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
321 return Implementsf(a.t, interfaceObject, object, msg, args...)
324 // InDelta asserts that the two numerals are within delta of each other.
326 // a.InDelta(math.Pi, (22 / 7.0), 0.01)
328 // Returns whether the assertion was successful (true) or not (false).
329 func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
330 return InDelta(a.t, expected, actual, delta, msgAndArgs...)
333 // InDeltaSlice is the same as InDelta, except it compares two slices.
334 func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
335 return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
338 // InDeltaSlicef is the same as InDelta, except it compares two slices.
339 func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
340 return InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
343 // InDeltaf asserts that the two numerals are within delta of each other.
345 // a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
347 // Returns whether the assertion was successful (true) or not (false).
348 func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
349 return InDeltaf(a.t, expected, actual, delta, msg, args...)
352 // InEpsilon asserts that expected and actual have a relative error less than epsilon
354 // Returns whether the assertion was successful (true) or not (false).
355 func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
356 return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
359 // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
360 func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
361 return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
364 // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
365 func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
366 return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
369 // InEpsilonf asserts that expected and actual have a relative error less than epsilon
371 // Returns whether the assertion was successful (true) or not (false).
372 func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
373 return InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
376 // IsType asserts that the specified objects are of the same type.
377 func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
378 return IsType(a.t, expectedType, object, msgAndArgs...)
381 // IsTypef asserts that the specified objects are of the same type.
382 func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
383 return IsTypef(a.t, expectedType, object, msg, args...)
386 // JSONEq asserts that two JSON strings are equivalent.
388 // a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
390 // Returns whether the assertion was successful (true) or not (false).
391 func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {
392 return JSONEq(a.t, expected, actual, msgAndArgs...)
395 // JSONEqf asserts that two JSON strings are equivalent.
397 // a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
399 // Returns whether the assertion was successful (true) or not (false).
400 func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {
401 return JSONEqf(a.t, expected, actual, msg, args...)
404 // Len asserts that the specified object has specific length.
405 // Len also fails if the object has a type that len() not accept.
409 // Returns whether the assertion was successful (true) or not (false).
410 func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {
411 return Len(a.t, object, length, msgAndArgs...)
414 // Lenf asserts that the specified object has specific length.
415 // Lenf also fails if the object has a type that len() not accept.
417 // a.Lenf(mySlice, 3, "error message %s", "formatted")
419 // Returns whether the assertion was successful (true) or not (false).
420 func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {
421 return Lenf(a.t, object, length, msg, args...)
424 // Nil asserts that the specified object is nil.
428 // Returns whether the assertion was successful (true) or not (false).
429 func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {
430 return Nil(a.t, object, msgAndArgs...)
433 // Nilf asserts that the specified object is nil.
435 // a.Nilf(err, "error message %s", "formatted")
437 // Returns whether the assertion was successful (true) or not (false).
438 func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {
439 return Nilf(a.t, object, msg, args...)
442 // NoError asserts that a function returned no error (i.e. `nil`).
444 // actualObj, err := SomeFunction()
445 // if a.NoError(err) {
446 // assert.Equal(t, expectedObj, actualObj)
449 // Returns whether the assertion was successful (true) or not (false).
450 func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
451 return NoError(a.t, err, msgAndArgs...)
454 // NoErrorf asserts that a function returned no error (i.e. `nil`).
456 // actualObj, err := SomeFunction()
457 // if a.NoErrorf(err, "error message %s", "formatted") {
458 // assert.Equal(t, expectedObj, actualObj)
461 // Returns whether the assertion was successful (true) or not (false).
462 func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {
463 return NoErrorf(a.t, err, msg, args...)
466 // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
467 // specified substring or element.
469 // a.NotContains("Hello World", "Earth")
470 // a.NotContains(["Hello", "World"], "Earth")
471 // a.NotContains({"Hello": "World"}, "Earth")
473 // Returns whether the assertion was successful (true) or not (false).
474 func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
475 return NotContains(a.t, s, contains, msgAndArgs...)
478 // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
479 // specified substring or element.
481 // a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
482 // a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
483 // a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
485 // Returns whether the assertion was successful (true) or not (false).
486 func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
487 return NotContainsf(a.t, s, contains, msg, args...)
490 // NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
491 // a slice or a channel with len == 0.
493 // if a.NotEmpty(obj) {
494 // assert.Equal(t, "two", obj[1])
497 // Returns whether the assertion was successful (true) or not (false).
498 func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {
499 return NotEmpty(a.t, object, msgAndArgs...)
502 // NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
503 // a slice or a channel with len == 0.
505 // if a.NotEmptyf(obj, "error message %s", "formatted") {
506 // assert.Equal(t, "two", obj[1])
509 // Returns whether the assertion was successful (true) or not (false).
510 func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {
511 return NotEmptyf(a.t, object, msg, args...)
514 // NotEqual asserts that the specified values are NOT equal.
516 // a.NotEqual(obj1, obj2)
518 // Returns whether the assertion was successful (true) or not (false).
520 // Pointer variable equality is determined based on the equality of the
521 // referenced values (as opposed to the memory addresses).
522 func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
523 return NotEqual(a.t, expected, actual, msgAndArgs...)
526 // NotEqualf asserts that the specified values are NOT equal.
528 // a.NotEqualf(obj1, obj2, "error message %s", "formatted")
530 // Returns whether the assertion was successful (true) or not (false).
532 // Pointer variable equality is determined based on the equality of the
533 // referenced values (as opposed to the memory addresses).
534 func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
535 return NotEqualf(a.t, expected, actual, msg, args...)
538 // NotNil asserts that the specified object is not nil.
542 // Returns whether the assertion was successful (true) or not (false).
543 func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {
544 return NotNil(a.t, object, msgAndArgs...)
547 // NotNilf asserts that the specified object is not nil.
549 // a.NotNilf(err, "error message %s", "formatted")
551 // Returns whether the assertion was successful (true) or not (false).
552 func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {
553 return NotNilf(a.t, object, msg, args...)
556 // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
558 // a.NotPanics(func(){ RemainCalm() })
560 // Returns whether the assertion was successful (true) or not (false).
561 func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
562 return NotPanics(a.t, f, msgAndArgs...)
565 // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
567 // a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
569 // Returns whether the assertion was successful (true) or not (false).
570 func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
571 return NotPanicsf(a.t, f, msg, args...)
574 // NotRegexp asserts that a specified regexp does not match a string.
576 // a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
577 // a.NotRegexp("^start", "it's not starting")
579 // Returns whether the assertion was successful (true) or not (false).
580 func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
581 return NotRegexp(a.t, rx, str, msgAndArgs...)
584 // NotRegexpf asserts that a specified regexp does not match a string.
586 // a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
587 // a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
589 // Returns whether the assertion was successful (true) or not (false).
590 func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
591 return NotRegexpf(a.t, rx, str, msg, args...)
594 // NotSubset asserts that the specified list(array, slice...) contains not all
595 // elements given in the specified subset(array, slice...).
597 // a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
599 // Returns whether the assertion was successful (true) or not (false).
600 func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
601 return NotSubset(a.t, list, subset, msgAndArgs...)
604 // NotSubsetf asserts that the specified list(array, slice...) contains not all
605 // elements given in the specified subset(array, slice...).
607 // a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
609 // Returns whether the assertion was successful (true) or not (false).
610 func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
611 return NotSubsetf(a.t, list, subset, msg, args...)
614 // NotZero asserts that i is not the zero value for its type and returns the truth.
615 func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {
616 return NotZero(a.t, i, msgAndArgs...)
619 // NotZerof asserts that i is not the zero value for its type and returns the truth.
620 func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool {
621 return NotZerof(a.t, i, msg, args...)
624 // Panics asserts that the code inside the specified PanicTestFunc panics.
626 // a.Panics(func(){ GoCrazy() })
628 // Returns whether the assertion was successful (true) or not (false).
629 func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
630 return Panics(a.t, f, msgAndArgs...)
633 // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
634 // the recovered panic value equals the expected panic value.
636 // a.PanicsWithValue("crazy error", func(){ GoCrazy() })
638 // Returns whether the assertion was successful (true) or not (false).
639 func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
640 return PanicsWithValue(a.t, expected, f, msgAndArgs...)
643 // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
644 // the recovered panic value equals the expected panic value.
646 // a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
648 // Returns whether the assertion was successful (true) or not (false).
649 func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
650 return PanicsWithValuef(a.t, expected, f, msg, args...)
653 // Panicsf asserts that the code inside the specified PanicTestFunc panics.
655 // a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
657 // Returns whether the assertion was successful (true) or not (false).
658 func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
659 return Panicsf(a.t, f, msg, args...)
662 // Regexp asserts that a specified regexp matches a string.
664 // a.Regexp(regexp.MustCompile("start"), "it's starting")
665 // a.Regexp("start...$", "it's not starting")
667 // Returns whether the assertion was successful (true) or not (false).
668 func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
669 return Regexp(a.t, rx, str, msgAndArgs...)
672 // Regexpf asserts that a specified regexp matches a string.
674 // a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
675 // a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
677 // Returns whether the assertion was successful (true) or not (false).
678 func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
679 return Regexpf(a.t, rx, str, msg, args...)
682 // Subset asserts that the specified list(array, slice...) contains all
683 // elements given in the specified subset(array, slice...).
685 // a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
687 // Returns whether the assertion was successful (true) or not (false).
688 func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
689 return Subset(a.t, list, subset, msgAndArgs...)
692 // Subsetf asserts that the specified list(array, slice...) contains all
693 // elements given in the specified subset(array, slice...).
695 // a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
697 // Returns whether the assertion was successful (true) or not (false).
698 func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
699 return Subsetf(a.t, list, subset, msg, args...)
702 // True asserts that the specified value is true.
706 // Returns whether the assertion was successful (true) or not (false).
707 func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
708 return True(a.t, value, msgAndArgs...)
711 // Truef asserts that the specified value is true.
713 // a.Truef(myBool, "error message %s", "formatted")
715 // Returns whether the assertion was successful (true) or not (false).
716 func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {
717 return Truef(a.t, value, msg, args...)
720 // WithinDuration asserts that the two times are within duration delta of each other.
722 // a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
724 // Returns whether the assertion was successful (true) or not (false).
725 func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
726 return WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
729 // WithinDurationf asserts that the two times are within duration delta of each other.
731 // a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
733 // Returns whether the assertion was successful (true) or not (false).
734 func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
735 return WithinDurationf(a.t, expected, actual, delta, msg, args...)
738 // Zero asserts that i is the zero value for its type and returns the truth.
739 func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {
740 return Zero(a.t, i, msgAndArgs...)
743 // Zerof asserts that i is the zero value for its type and returns the truth.
744 func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool {
745 return Zerof(a.t, i, msg, args...)