2017-07-23 09:51:42 +02:00
/ *
* CODE GENERATED AUTOMATICALLY WITH github . com / stretchr / testify / _codegen
* THIS FILE MUST NOT BE EDITED BY HAND
* /
package assert
import (
http "net/http"
url "net/url"
time "time"
)
// Conditionf uses a Comparison to assert a complex condition.
func Conditionf ( t TestingT , comp Comparison , msg string , args ... interface { } ) bool {
return Condition ( t , comp , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Containsf asserts that the specified string, list(array, slice...) or map contains the
// specified substring or element.
//
// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
func Containsf ( t TestingT , s interface { } , contains interface { } , msg string , args ... interface { } ) bool {
return Contains ( t , s , contains , append ( [ ] interface { } { msg } , args ... ) ... )
}
2018-01-16 14:20:59 +01:00
// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
func DirExistsf ( t TestingT , path string , msg string , args ... interface { } ) bool {
return DirExists ( t , path , append ( [ ] interface { } { msg } , args ... ) ... )
}
// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
// the number of appearances of each of them in both lists should match.
//
2018-03-19 16:51:38 +01:00
// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
2018-01-16 14:20:59 +01:00
func ElementsMatchf ( t TestingT , listA interface { } , listB interface { } , msg string , args ... interface { } ) bool {
return ElementsMatch ( t , listA , listB , append ( [ ] interface { } { msg } , args ... ) ... )
}
2017-07-23 09:51:42 +02:00
// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// assert.Emptyf(t, obj, "error message %s", "formatted")
func Emptyf ( t TestingT , object interface { } , msg string , args ... interface { } ) bool {
return Empty ( t , object , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Equalf asserts that two objects are equal.
//
// assert.Equalf(t, 123, 123, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). Function equality
// cannot be determined and will always fail.
func Equalf ( t TestingT , expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
return Equal ( t , expected , actual , append ( [ ] interface { } { msg } , args ... ) ... )
}
// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
// and that it is equal to the provided error.
//
// actualObj, err := SomeFunction()
// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
func EqualErrorf ( t TestingT , theError error , errString string , msg string , args ... interface { } ) bool {
return EqualError ( t , theError , errString , append ( [ ] interface { } { msg } , args ... ) ... )
}
// EqualValuesf asserts that two objects are equal or convertable to the same types
// and equal.
//
// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
func EqualValuesf ( t TestingT , expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
return EqualValues ( t , expected , actual , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Errorf asserts that a function returned an error (i.e. not `nil`).
//
// actualObj, err := SomeFunction()
// if assert.Errorf(t, err, "error message %s", "formatted") {
// assert.Equal(t, expectedErrorf, err)
// }
func Errorf ( t TestingT , err error , msg string , args ... interface { } ) bool {
return Error ( t , err , append ( [ ] interface { } { msg } , args ... ) ... )
}
2018-01-16 14:20:59 +01:00
// Exactlyf asserts that two objects are equal in value and type.
2017-07-23 09:51:42 +02:00
//
// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
func Exactlyf ( t TestingT , expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
return Exactly ( t , expected , actual , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Failf reports a failure through
func Failf ( t TestingT , failureMessage string , msg string , args ... interface { } ) bool {
return Fail ( t , failureMessage , append ( [ ] interface { } { msg } , args ... ) ... )
}
// FailNowf fails test
func FailNowf ( t TestingT , failureMessage string , msg string , args ... interface { } ) bool {
return FailNow ( t , failureMessage , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Falsef asserts that the specified value is false.
//
// assert.Falsef(t, myBool, "error message %s", "formatted")
func Falsef ( t TestingT , value bool , msg string , args ... interface { } ) bool {
return False ( t , value , append ( [ ] interface { } { msg } , args ... ) ... )
}
2018-01-16 14:20:59 +01:00
// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
func FileExistsf ( t TestingT , path string , msg string , args ... interface { } ) bool {
return FileExists ( t , path , append ( [ ] interface { } { msg } , args ... ) ... )
}
2017-07-23 09:51:42 +02:00
// HTTPBodyContainsf asserts that a specified handler returns a
// body that contains a string.
//
// assert.HTTPBodyContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
2018-01-16 14:20:59 +01:00
func HTTPBodyContainsf ( t TestingT , handler http . HandlerFunc , method string , url string , values url . Values , str interface { } , msg string , args ... interface { } ) bool {
return HTTPBodyContains ( t , handler , method , url , values , str , append ( [ ] interface { } { msg } , args ... ) ... )
2017-07-23 09:51:42 +02:00
}
// HTTPBodyNotContainsf asserts that a specified handler returns a
// body that does not contain a string.
//
// assert.HTTPBodyNotContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
2018-01-16 14:20:59 +01:00
func HTTPBodyNotContainsf ( t TestingT , handler http . HandlerFunc , method string , url string , values url . Values , str interface { } , msg string , args ... interface { } ) bool {
return HTTPBodyNotContains ( t , handler , method , url , values , str , append ( [ ] interface { } { msg } , args ... ) ... )
2017-07-23 09:51:42 +02:00
}
// HTTPErrorf asserts that a specified handler returns an error status code.
//
// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
2018-01-16 14:20:59 +01:00
func HTTPErrorf ( t TestingT , handler http . HandlerFunc , method string , url string , values url . Values , msg string , args ... interface { } ) bool {
return HTTPError ( t , handler , method , url , values , append ( [ ] interface { } { msg } , args ... ) ... )
2017-07-23 09:51:42 +02:00
}
// HTTPRedirectf asserts that a specified handler returns a redirect status code.
//
// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
2018-01-16 14:20:59 +01:00
func HTTPRedirectf ( t TestingT , handler http . HandlerFunc , method string , url string , values url . Values , msg string , args ... interface { } ) bool {
return HTTPRedirect ( t , handler , method , url , values , append ( [ ] interface { } { msg } , args ... ) ... )
2017-07-23 09:51:42 +02:00
}
// HTTPSuccessf asserts that a specified handler returns a success status code.
//
// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
2018-01-16 14:20:59 +01:00
func HTTPSuccessf ( t TestingT , handler http . HandlerFunc , method string , url string , values url . Values , msg string , args ... interface { } ) bool {
return HTTPSuccess ( t , handler , method , url , values , append ( [ ] interface { } { msg } , args ... ) ... )
2017-07-23 09:51:42 +02:00
}
// Implementsf asserts that an object is implemented by the specified interface.
//
// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
func Implementsf ( t TestingT , interfaceObject interface { } , object interface { } , msg string , args ... interface { } ) bool {
return Implements ( t , interfaceObject , object , append ( [ ] interface { } { msg } , args ... ) ... )
}
// InDeltaf asserts that the two numerals are within delta of each other.
//
// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
func InDeltaf ( t TestingT , expected interface { } , actual interface { } , delta float64 , msg string , args ... interface { } ) bool {
return InDelta ( t , expected , actual , delta , append ( [ ] interface { } { msg } , args ... ) ... )
}
2018-01-16 14:20:59 +01:00
// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
func InDeltaMapValuesf ( t TestingT , expected interface { } , actual interface { } , delta float64 , msg string , args ... interface { } ) bool {
return InDeltaMapValues ( t , expected , actual , delta , append ( [ ] interface { } { msg } , args ... ) ... )
}
2017-07-23 09:51:42 +02:00
// InDeltaSlicef is the same as InDelta, except it compares two slices.
func InDeltaSlicef ( t TestingT , expected interface { } , actual interface { } , delta float64 , msg string , args ... interface { } ) bool {
return InDeltaSlice ( t , expected , actual , delta , append ( [ ] interface { } { msg } , args ... ) ... )
}
// InEpsilonf asserts that expected and actual have a relative error less than epsilon
func InEpsilonf ( t TestingT , expected interface { } , actual interface { } , epsilon float64 , msg string , args ... interface { } ) bool {
return InEpsilon ( t , expected , actual , epsilon , append ( [ ] interface { } { msg } , args ... ) ... )
}
// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
func InEpsilonSlicef ( t TestingT , expected interface { } , actual interface { } , epsilon float64 , msg string , args ... interface { } ) bool {
return InEpsilonSlice ( t , expected , actual , epsilon , append ( [ ] interface { } { msg } , args ... ) ... )
}
// IsTypef asserts that the specified objects are of the same type.
func IsTypef ( t TestingT , expectedType interface { } , object interface { } , msg string , args ... interface { } ) bool {
return IsType ( t , expectedType , object , append ( [ ] interface { } { msg } , args ... ) ... )
}
// JSONEqf asserts that two JSON strings are equivalent.
//
// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
func JSONEqf ( t TestingT , expected string , actual string , msg string , args ... interface { } ) bool {
return JSONEq ( t , expected , actual , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Lenf asserts that the specified object has specific length.
// Lenf also fails if the object has a type that len() not accept.
//
// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
func Lenf ( t TestingT , object interface { } , length int , msg string , args ... interface { } ) bool {
return Len ( t , object , length , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Nilf asserts that the specified object is nil.
//
// assert.Nilf(t, err, "error message %s", "formatted")
func Nilf ( t TestingT , object interface { } , msg string , args ... interface { } ) bool {
return Nil ( t , object , append ( [ ] interface { } { msg } , args ... ) ... )
}
// NoErrorf asserts that a function returned no error (i.e. `nil`).
//
// actualObj, err := SomeFunction()
// if assert.NoErrorf(t, err, "error message %s", "formatted") {
// assert.Equal(t, expectedObj, actualObj)
// }
func NoErrorf ( t TestingT , err error , msg string , args ... interface { } ) bool {
return NoError ( t , err , append ( [ ] interface { } { msg } , args ... ) ... )
}
// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
// specified substring or element.
//
// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
func NotContainsf ( t TestingT , s interface { } , contains interface { } , msg string , args ... interface { } ) bool {
return NotContains ( t , s , contains , append ( [ ] interface { } { msg } , args ... ) ... )
}
// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
// a slice or a channel with len == 0.
//
// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
// assert.Equal(t, "two", obj[1])
// }
func NotEmptyf ( t TestingT , object interface { } , msg string , args ... interface { } ) bool {
return NotEmpty ( t , object , append ( [ ] interface { } { msg } , args ... ) ... )
}
// NotEqualf asserts that the specified values are NOT equal.
//
// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
//
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
func NotEqualf ( t TestingT , expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
return NotEqual ( t , expected , actual , append ( [ ] interface { } { msg } , args ... ) ... )
}
// NotNilf asserts that the specified object is not nil.
//
// assert.NotNilf(t, err, "error message %s", "formatted")
func NotNilf ( t TestingT , object interface { } , msg string , args ... interface { } ) bool {
return NotNil ( t , object , append ( [ ] interface { } { msg } , args ... ) ... )
}
// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
func NotPanicsf ( t TestingT , f PanicTestFunc , msg string , args ... interface { } ) bool {
return NotPanics ( t , f , append ( [ ] interface { } { msg } , args ... ) ... )
}
// NotRegexpf asserts that a specified regexp does not match a string.
//
// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
func NotRegexpf ( t TestingT , rx interface { } , str interface { } , msg string , args ... interface { } ) bool {
return NotRegexp ( t , rx , str , append ( [ ] interface { } { msg } , args ... ) ... )
}
// NotSubsetf asserts that the specified list(array, slice...) contains not all
// elements given in the specified subset(array, slice...).
//
// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
func NotSubsetf ( t TestingT , list interface { } , subset interface { } , msg string , args ... interface { } ) bool {
return NotSubset ( t , list , subset , append ( [ ] interface { } { msg } , args ... ) ... )
}
2018-01-16 14:20:59 +01:00
// NotZerof asserts that i is not the zero value for its type.
2017-07-23 09:51:42 +02:00
func NotZerof ( t TestingT , i interface { } , msg string , args ... interface { } ) bool {
return NotZero ( t , i , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Panicsf asserts that the code inside the specified PanicTestFunc panics.
//
// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
func Panicsf ( t TestingT , f PanicTestFunc , msg string , args ... interface { } ) bool {
return Panics ( t , f , append ( [ ] interface { } { msg } , args ... ) ... )
}
// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
// the recovered panic value equals the expected panic value.
//
// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
func PanicsWithValuef ( t TestingT , expected interface { } , f PanicTestFunc , msg string , args ... interface { } ) bool {
return PanicsWithValue ( t , expected , f , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Regexpf asserts that a specified regexp matches a string.
//
// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
func Regexpf ( t TestingT , rx interface { } , str interface { } , msg string , args ... interface { } ) bool {
return Regexp ( t , rx , str , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Subsetf asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
//
// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
func Subsetf ( t TestingT , list interface { } , subset interface { } , msg string , args ... interface { } ) bool {
return Subset ( t , list , subset , append ( [ ] interface { } { msg } , args ... ) ... )
}
// Truef asserts that the specified value is true.
//
// assert.Truef(t, myBool, "error message %s", "formatted")
func Truef ( t TestingT , value bool , msg string , args ... interface { } ) bool {
return True ( t , value , append ( [ ] interface { } { msg } , args ... ) ... )
}
// WithinDurationf asserts that the two times are within duration delta of each other.
//
// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
func WithinDurationf ( t TestingT , expected time . Time , actual time . Time , delta time . Duration , msg string , args ... interface { } ) bool {
return WithinDuration ( t , expected , actual , delta , append ( [ ] interface { } { msg } , args ... ) ... )
}
2018-01-16 14:20:59 +01:00
// Zerof asserts that i is the zero value for its type.
2017-07-23 09:51:42 +02:00
func Zerof ( t TestingT , i interface { } , msg string , args ... interface { } ) bool {
return Zero ( t , i , append ( [ ] interface { } { msg } , args ... ) ... )
}