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 Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {
17 if !assert.Condition(t, comp, msgAndArgs...) {
22 // Conditionf uses a Comparison to assert a complex condition.
23 func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {
24 if !assert.Conditionf(t, comp, msg, args...) {
29 // Contains asserts that the specified string, list(array, slice...) or map contains the
30 // specified substring or element.
32 // assert.Contains(t, "Hello World", "World")
33 // assert.Contains(t, ["Hello", "World"], "World")
34 // assert.Contains(t, {"Hello": "World"}, "Hello")
36 // Returns whether the assertion was successful (true) or not (false).
37 func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
38 if !assert.Contains(t, s, contains, msgAndArgs...) {
43 // Containsf asserts that the specified string, list(array, slice...) or map contains the
44 // specified substring or element.
46 // assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
47 // assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
48 // assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
50 // Returns whether the assertion was successful (true) or not (false).
51 func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
52 if !assert.Containsf(t, s, contains, msg, args...) {
57 // Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
58 // a slice or a channel with len == 0.
60 // assert.Empty(t, obj)
62 // Returns whether the assertion was successful (true) or not (false).
63 func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
64 if !assert.Empty(t, object, msgAndArgs...) {
69 // Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
70 // a slice or a channel with len == 0.
72 // assert.Emptyf(t, obj, "error message %s", "formatted")
74 // Returns whether the assertion was successful (true) or not (false).
75 func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
76 if !assert.Emptyf(t, object, msg, args...) {
81 // Equal asserts that two objects are equal.
83 // assert.Equal(t, 123, 123)
85 // Returns whether the assertion was successful (true) or not (false).
87 // Pointer variable equality is determined based on the equality of the
88 // referenced values (as opposed to the memory addresses). Function equality
89 // cannot be determined and will always fail.
90 func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
91 if !assert.Equal(t, expected, actual, msgAndArgs...) {
96 // EqualError asserts that a function returned an error (i.e. not `nil`)
97 // and that it is equal to the provided error.
99 // actualObj, err := SomeFunction()
100 // assert.EqualError(t, err, expectedErrorString)
102 // Returns whether the assertion was successful (true) or not (false).
103 func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
104 if !assert.EqualError(t, theError, errString, msgAndArgs...) {
109 // EqualErrorf asserts that a function returned an error (i.e. not `nil`)
110 // and that it is equal to the provided error.
112 // actualObj, err := SomeFunction()
113 // assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
115 // Returns whether the assertion was successful (true) or not (false).
116 func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {
117 if !assert.EqualErrorf(t, theError, errString, msg, args...) {
122 // EqualValues asserts that two objects are equal or convertable to the same types
125 // assert.EqualValues(t, uint32(123), int32(123))
127 // Returns whether the assertion was successful (true) or not (false).
128 func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
129 if !assert.EqualValues(t, expected, actual, msgAndArgs...) {
134 // EqualValuesf asserts that two objects are equal or convertable to the same types
137 // assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
139 // Returns whether the assertion was successful (true) or not (false).
140 func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
141 if !assert.EqualValuesf(t, expected, actual, msg, args...) {
146 // Equalf asserts that two objects are equal.
148 // assert.Equalf(t, 123, 123, "error message %s", "formatted")
150 // Returns whether the assertion was successful (true) or not (false).
152 // Pointer variable equality is determined based on the equality of the
153 // referenced values (as opposed to the memory addresses). Function equality
154 // cannot be determined and will always fail.
155 func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
156 if !assert.Equalf(t, expected, actual, msg, args...) {
161 // Error asserts that a function returned an error (i.e. not `nil`).
163 // actualObj, err := SomeFunction()
164 // if assert.Error(t, err) {
165 // assert.Equal(t, expectedError, err)
168 // Returns whether the assertion was successful (true) or not (false).
169 func Error(t TestingT, err error, msgAndArgs ...interface{}) {
170 if !assert.Error(t, err, msgAndArgs...) {
175 // Errorf asserts that a function returned an error (i.e. not `nil`).
177 // actualObj, err := SomeFunction()
178 // if assert.Errorf(t, err, "error message %s", "formatted") {
179 // assert.Equal(t, expectedErrorf, err)
182 // Returns whether the assertion was successful (true) or not (false).
183 func Errorf(t TestingT, err error, msg string, args ...interface{}) {
184 if !assert.Errorf(t, err, msg, args...) {
189 // Exactly asserts that two objects are equal is value and type.
191 // assert.Exactly(t, int32(123), int64(123))
193 // Returns whether the assertion was successful (true) or not (false).
194 func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
195 if !assert.Exactly(t, expected, actual, msgAndArgs...) {
200 // Exactlyf asserts that two objects are equal is value and type.
202 // assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
204 // Returns whether the assertion was successful (true) or not (false).
205 func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
206 if !assert.Exactlyf(t, expected, actual, msg, args...) {
211 // Fail reports a failure through
212 func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
213 if !assert.Fail(t, failureMessage, msgAndArgs...) {
218 // FailNow fails test
219 func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
220 if !assert.FailNow(t, failureMessage, msgAndArgs...) {
225 // FailNowf fails test
226 func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {
227 if !assert.FailNowf(t, failureMessage, msg, args...) {
232 // Failf reports a failure through
233 func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {
234 if !assert.Failf(t, failureMessage, msg, args...) {
239 // False asserts that the specified value is false.
241 // assert.False(t, myBool)
243 // Returns whether the assertion was successful (true) or not (false).
244 func False(t TestingT, value bool, msgAndArgs ...interface{}) {
245 if !assert.False(t, value, msgAndArgs...) {
250 // Falsef asserts that the specified value is false.
252 // assert.Falsef(t, myBool, "error message %s", "formatted")
254 // Returns whether the assertion was successful (true) or not (false).
255 func Falsef(t TestingT, value bool, msg string, args ...interface{}) {
256 if !assert.Falsef(t, value, msg, args...) {
261 // HTTPBodyContains asserts that a specified handler returns a
262 // body that contains a string.
264 // assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
266 // Returns whether the assertion was successful (true) or not (false).
267 func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
268 if !assert.HTTPBodyContains(t, handler, method, url, values, str) {
273 // HTTPBodyContainsf asserts that a specified handler returns a
274 // body that contains a string.
276 // assert.HTTPBodyContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
278 // Returns whether the assertion was successful (true) or not (false).
279 func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
280 if !assert.HTTPBodyContainsf(t, handler, method, url, values, str) {
285 // HTTPBodyNotContains asserts that a specified handler returns a
286 // body that does not contain a string.
288 // assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
290 // Returns whether the assertion was successful (true) or not (false).
291 func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
292 if !assert.HTTPBodyNotContains(t, handler, method, url, values, str) {
297 // HTTPBodyNotContainsf asserts that a specified handler returns a
298 // body that does not contain a string.
300 // assert.HTTPBodyNotContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
302 // Returns whether the assertion was successful (true) or not (false).
303 func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
304 if !assert.HTTPBodyNotContainsf(t, handler, method, url, values, str) {
309 // HTTPError asserts that a specified handler returns an error status code.
311 // assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
313 // Returns whether the assertion was successful (true) or not (false).
314 func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
315 if !assert.HTTPError(t, handler, method, url, values) {
320 // HTTPErrorf asserts that a specified handler returns an error status code.
322 // assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
324 // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
325 func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
326 if !assert.HTTPErrorf(t, handler, method, url, values) {
331 // HTTPRedirect asserts that a specified handler returns a redirect status code.
333 // assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
335 // Returns whether the assertion was successful (true) or not (false).
336 func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
337 if !assert.HTTPRedirect(t, handler, method, url, values) {
342 // HTTPRedirectf asserts that a specified handler returns a redirect status code.
344 // assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
346 // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
347 func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
348 if !assert.HTTPRedirectf(t, handler, method, url, values) {
353 // HTTPSuccess asserts that a specified handler returns a success status code.
355 // assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
357 // Returns whether the assertion was successful (true) or not (false).
358 func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
359 if !assert.HTTPSuccess(t, handler, method, url, values) {
364 // HTTPSuccessf asserts that a specified handler returns a success status code.
366 // assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
368 // Returns whether the assertion was successful (true) or not (false).
369 func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
370 if !assert.HTTPSuccessf(t, handler, method, url, values) {
375 // Implements asserts that an object is implemented by the specified interface.
377 // assert.Implements(t, (*MyInterface)(nil), new(MyObject))
378 func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
379 if !assert.Implements(t, interfaceObject, object, msgAndArgs...) {
384 // Implementsf asserts that an object is implemented by the specified interface.
386 // assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
387 func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
388 if !assert.Implementsf(t, interfaceObject, object, msg, args...) {
393 // InDelta asserts that the two numerals are within delta of each other.
395 // assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)
397 // Returns whether the assertion was successful (true) or not (false).
398 func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
399 if !assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
404 // InDeltaSlice is the same as InDelta, except it compares two slices.
405 func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
406 if !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {
411 // InDeltaSlicef is the same as InDelta, except it compares two slices.
412 func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
413 if !assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {
418 // InDeltaf asserts that the two numerals are within delta of each other.
420 // assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
422 // Returns whether the assertion was successful (true) or not (false).
423 func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
424 if !assert.InDeltaf(t, expected, actual, delta, msg, args...) {
429 // InEpsilon asserts that expected and actual have a relative error less than epsilon
431 // Returns whether the assertion was successful (true) or not (false).
432 func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
433 if !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {
438 // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
439 func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
440 if !assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) {
445 // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
446 func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
447 if !assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {
452 // InEpsilonf asserts that expected and actual have a relative error less than epsilon
454 // Returns whether the assertion was successful (true) or not (false).
455 func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
456 if !assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {
461 // IsType asserts that the specified objects are of the same type.
462 func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
463 if !assert.IsType(t, expectedType, object, msgAndArgs...) {
468 // IsTypef asserts that the specified objects are of the same type.
469 func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {
470 if !assert.IsTypef(t, expectedType, object, msg, args...) {
475 // JSONEq asserts that two JSON strings are equivalent.
477 // assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
479 // Returns whether the assertion was successful (true) or not (false).
480 func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
481 if !assert.JSONEq(t, expected, actual, msgAndArgs...) {
486 // JSONEqf asserts that two JSON strings are equivalent.
488 // assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
490 // Returns whether the assertion was successful (true) or not (false).
491 func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {
492 if !assert.JSONEqf(t, expected, actual, msg, args...) {
497 // Len asserts that the specified object has specific length.
498 // Len also fails if the object has a type that len() not accept.
500 // assert.Len(t, mySlice, 3)
502 // Returns whether the assertion was successful (true) or not (false).
503 func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {
504 if !assert.Len(t, object, length, msgAndArgs...) {
509 // Lenf asserts that the specified object has specific length.
510 // Lenf also fails if the object has a type that len() not accept.
512 // assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
514 // Returns whether the assertion was successful (true) or not (false).
515 func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {
516 if !assert.Lenf(t, object, length, msg, args...) {
521 // Nil asserts that the specified object is nil.
523 // assert.Nil(t, err)
525 // Returns whether the assertion was successful (true) or not (false).
526 func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
527 if !assert.Nil(t, object, msgAndArgs...) {
532 // Nilf asserts that the specified object is nil.
534 // assert.Nilf(t, err, "error message %s", "formatted")
536 // Returns whether the assertion was successful (true) or not (false).
537 func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {
538 if !assert.Nilf(t, object, msg, args...) {
543 // NoError asserts that a function returned no error (i.e. `nil`).
545 // actualObj, err := SomeFunction()
546 // if assert.NoError(t, err) {
547 // assert.Equal(t, expectedObj, actualObj)
550 // Returns whether the assertion was successful (true) or not (false).
551 func NoError(t TestingT, err error, msgAndArgs ...interface{}) {
552 if !assert.NoError(t, err, msgAndArgs...) {
557 // NoErrorf asserts that a function returned no error (i.e. `nil`).
559 // actualObj, err := SomeFunction()
560 // if assert.NoErrorf(t, err, "error message %s", "formatted") {
561 // assert.Equal(t, expectedObj, actualObj)
564 // Returns whether the assertion was successful (true) or not (false).
565 func NoErrorf(t TestingT, err error, msg string, args ...interface{}) {
566 if !assert.NoErrorf(t, err, msg, args...) {
571 // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
572 // specified substring or element.
574 // assert.NotContains(t, "Hello World", "Earth")
575 // assert.NotContains(t, ["Hello", "World"], "Earth")
576 // assert.NotContains(t, {"Hello": "World"}, "Earth")
578 // Returns whether the assertion was successful (true) or not (false).
579 func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
580 if !assert.NotContains(t, s, contains, msgAndArgs...) {
585 // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
586 // specified substring or element.
588 // assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
589 // assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
590 // assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
592 // Returns whether the assertion was successful (true) or not (false).
593 func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
594 if !assert.NotContainsf(t, s, contains, msg, args...) {
599 // NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
600 // a slice or a channel with len == 0.
602 // if assert.NotEmpty(t, obj) {
603 // assert.Equal(t, "two", obj[1])
606 // Returns whether the assertion was successful (true) or not (false).
607 func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
608 if !assert.NotEmpty(t, object, msgAndArgs...) {
613 // NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
614 // a slice or a channel with len == 0.
616 // if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
617 // assert.Equal(t, "two", obj[1])
620 // Returns whether the assertion was successful (true) or not (false).
621 func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
622 if !assert.NotEmptyf(t, object, msg, args...) {
627 // NotEqual asserts that the specified values are NOT equal.
629 // assert.NotEqual(t, obj1, obj2)
631 // Returns whether the assertion was successful (true) or not (false).
633 // Pointer variable equality is determined based on the equality of the
634 // referenced values (as opposed to the memory addresses).
635 func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
636 if !assert.NotEqual(t, expected, actual, msgAndArgs...) {
641 // NotEqualf asserts that the specified values are NOT equal.
643 // assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
645 // Returns whether the assertion was successful (true) or not (false).
647 // Pointer variable equality is determined based on the equality of the
648 // referenced values (as opposed to the memory addresses).
649 func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
650 if !assert.NotEqualf(t, expected, actual, msg, args...) {
655 // NotNil asserts that the specified object is not nil.
657 // assert.NotNil(t, err)
659 // Returns whether the assertion was successful (true) or not (false).
660 func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
661 if !assert.NotNil(t, object, msgAndArgs...) {
666 // NotNilf asserts that the specified object is not nil.
668 // assert.NotNilf(t, err, "error message %s", "formatted")
670 // Returns whether the assertion was successful (true) or not (false).
671 func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {
672 if !assert.NotNilf(t, object, msg, args...) {
677 // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
679 // assert.NotPanics(t, func(){ RemainCalm() })
681 // Returns whether the assertion was successful (true) or not (false).
682 func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
683 if !assert.NotPanics(t, f, msgAndArgs...) {
688 // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
690 // assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
692 // Returns whether the assertion was successful (true) or not (false).
693 func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
694 if !assert.NotPanicsf(t, f, msg, args...) {
699 // NotRegexp asserts that a specified regexp does not match a string.
701 // assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
702 // assert.NotRegexp(t, "^start", "it's not starting")
704 // Returns whether the assertion was successful (true) or not (false).
705 func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
706 if !assert.NotRegexp(t, rx, str, msgAndArgs...) {
711 // NotRegexpf asserts that a specified regexp does not match a string.
713 // assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
714 // assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
716 // Returns whether the assertion was successful (true) or not (false).
717 func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
718 if !assert.NotRegexpf(t, rx, str, msg, args...) {
723 // NotSubset asserts that the specified list(array, slice...) contains not all
724 // elements given in the specified subset(array, slice...).
726 // assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
728 // Returns whether the assertion was successful (true) or not (false).
729 func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
730 if !assert.NotSubset(t, list, subset, msgAndArgs...) {
735 // NotSubsetf asserts that the specified list(array, slice...) contains not all
736 // elements given in the specified subset(array, slice...).
738 // assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
740 // Returns whether the assertion was successful (true) or not (false).
741 func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
742 if !assert.NotSubsetf(t, list, subset, msg, args...) {
747 // NotZero asserts that i is not the zero value for its type and returns the truth.
748 func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
749 if !assert.NotZero(t, i, msgAndArgs...) {
754 // NotZerof asserts that i is not the zero value for its type and returns the truth.
755 func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {
756 if !assert.NotZerof(t, i, msg, args...) {
761 // Panics asserts that the code inside the specified PanicTestFunc panics.
763 // assert.Panics(t, func(){ GoCrazy() })
765 // Returns whether the assertion was successful (true) or not (false).
766 func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
767 if !assert.Panics(t, f, msgAndArgs...) {
772 // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
773 // the recovered panic value equals the expected panic value.
775 // assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
777 // Returns whether the assertion was successful (true) or not (false).
778 func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
779 if !assert.PanicsWithValue(t, expected, f, msgAndArgs...) {
784 // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
785 // the recovered panic value equals the expected panic value.
787 // assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
789 // Returns whether the assertion was successful (true) or not (false).
790 func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
791 if !assert.PanicsWithValuef(t, expected, f, msg, args...) {
796 // Panicsf asserts that the code inside the specified PanicTestFunc panics.
798 // assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
800 // Returns whether the assertion was successful (true) or not (false).
801 func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
802 if !assert.Panicsf(t, f, msg, args...) {
807 // Regexp asserts that a specified regexp matches a string.
809 // assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
810 // assert.Regexp(t, "start...$", "it's not starting")
812 // Returns whether the assertion was successful (true) or not (false).
813 func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
814 if !assert.Regexp(t, rx, str, msgAndArgs...) {
819 // Regexpf asserts that a specified regexp matches a string.
821 // assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
822 // assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
824 // Returns whether the assertion was successful (true) or not (false).
825 func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
826 if !assert.Regexpf(t, rx, str, msg, args...) {
831 // Subset asserts that the specified list(array, slice...) contains all
832 // elements given in the specified subset(array, slice...).
834 // assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
836 // Returns whether the assertion was successful (true) or not (false).
837 func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
838 if !assert.Subset(t, list, subset, msgAndArgs...) {
843 // Subsetf asserts that the specified list(array, slice...) contains all
844 // elements given in the specified subset(array, slice...).
846 // assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
848 // Returns whether the assertion was successful (true) or not (false).
849 func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
850 if !assert.Subsetf(t, list, subset, msg, args...) {
855 // True asserts that the specified value is true.
857 // assert.True(t, myBool)
859 // Returns whether the assertion was successful (true) or not (false).
860 func True(t TestingT, value bool, msgAndArgs ...interface{}) {
861 if !assert.True(t, value, msgAndArgs...) {
866 // Truef asserts that the specified value is true.
868 // assert.Truef(t, myBool, "error message %s", "formatted")
870 // Returns whether the assertion was successful (true) or not (false).
871 func Truef(t TestingT, value bool, msg string, args ...interface{}) {
872 if !assert.Truef(t, value, msg, args...) {
877 // WithinDuration asserts that the two times are within duration delta of each other.
879 // assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
881 // Returns whether the assertion was successful (true) or not (false).
882 func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
883 if !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {
888 // WithinDurationf asserts that the two times are within duration delta of each other.
890 // assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
892 // Returns whether the assertion was successful (true) or not (false).
893 func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
894 if !assert.WithinDurationf(t, expected, actual, delta, msg, args...) {
899 // Zero asserts that i is the zero value for its type and returns the truth.
900 func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
901 if !assert.Zero(t, i, msgAndArgs...) {
906 // Zerof asserts that i is the zero value for its type and returns the truth.
907 func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {
908 if !assert.Zerof(t, i, msg, args...) {