@ -27,8 +27,6 @@ func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}
// a.Contains("Hello World", "World")
// a.Contains("Hello World", "World")
// a.Contains(["Hello", "World"], "World")
// a.Contains(["Hello", "World"], "World")
// a.Contains({"Hello": "World"}, "Hello")
// a.Contains({"Hello": "World"}, "Hello")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Contains ( s interface { } , contains interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Contains ( s interface { } , contains interface { } , msgAndArgs ... interface { } ) bool {
return Contains ( a . t , s , contains , msgAndArgs ... )
return Contains ( a . t , s , contains , msgAndArgs ... )
}
}
@ -39,18 +37,42 @@ func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ..
// a.Containsf("Hello World", "World", "error message %s", "formatted")
// a.Containsf("Hello World", "World", "error message %s", "formatted")
// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Containsf ( s interface { } , contains interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Containsf ( s interface { } , contains interface { } , msg string , args ... interface { } ) bool {
return Containsf ( a . t , s , contains , msg , args ... )
return Containsf ( a . t , s , contains , msg , args ... )
}
}
// DirExists 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 ( a * Assertions ) DirExists ( path string , msgAndArgs ... interface { } ) bool {
return DirExists ( a . t , path , msgAndArgs ... )
}
// 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 ( a * Assertions ) DirExistsf ( path string , msg string , args ... interface { } ) bool {
return DirExistsf ( a . t , path , msg , args ... )
}
// ElementsMatch 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.
//
// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])
func ( a * Assertions ) ElementsMatch ( listA interface { } , listB interface { } , msgAndArgs ... interface { } ) bool {
return ElementsMatch ( a . t , listA , listB , msgAndArgs ... )
}
// 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.
//
// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
func ( a * Assertions ) ElementsMatchf ( listA interface { } , listB interface { } , msg string , args ... interface { } ) bool {
return ElementsMatchf ( a . t , listA , listB , msg , args ... )
}
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
// a slice or a channel with len == 0.
// a slice or a channel with len == 0.
//
//
// a.Empty(obj)
// a.Empty(obj)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Empty ( object interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Empty ( object interface { } , msgAndArgs ... interface { } ) bool {
return Empty ( a . t , object , msgAndArgs ... )
return Empty ( a . t , object , msgAndArgs ... )
}
}
@ -59,8 +81,6 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {
// a slice or a channel with len == 0.
// a slice or a channel with len == 0.
//
//
// a.Emptyf(obj, "error message %s", "formatted")
// a.Emptyf(obj, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Emptyf ( object interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Emptyf ( object interface { } , msg string , args ... interface { } ) bool {
return Emptyf ( a . t , object , msg , args ... )
return Emptyf ( a . t , object , msg , args ... )
}
}
@ -69,8 +89,6 @@ func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{})
//
//
// a.Equal(123, 123)
// a.Equal(123, 123)
//
//
// Returns whether the assertion was successful (true) or not (false).
//
// Pointer variable equality is determined based on the equality of the
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). Function equality
// referenced values (as opposed to the memory addresses). Function equality
// cannot be determined and will always fail.
// cannot be determined and will always fail.
@ -83,8 +101,6 @@ func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs
//
//
// actualObj, err := SomeFunction()
// actualObj, err := SomeFunction()
// a.EqualError(err, expectedErrorString)
// a.EqualError(err, expectedErrorString)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) EqualError ( theError error , errString string , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) EqualError ( theError error , errString string , msgAndArgs ... interface { } ) bool {
return EqualError ( a . t , theError , errString , msgAndArgs ... )
return EqualError ( a . t , theError , errString , msgAndArgs ... )
}
}
@ -94,8 +110,6 @@ func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...
//
//
// actualObj, err := SomeFunction()
// actualObj, err := SomeFunction()
// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) EqualErrorf ( theError error , errString string , msg string , args ... interface { } ) bool {
func ( a * Assertions ) EqualErrorf ( theError error , errString string , msg string , args ... interface { } ) bool {
return EqualErrorf ( a . t , theError , errString , msg , args ... )
return EqualErrorf ( a . t , theError , errString , msg , args ... )
}
}
@ -104,8 +118,6 @@ func (a *Assertions) EqualErrorf(theError error, errString string, msg string, a
// and equal.
// and equal.
//
//
// a.EqualValues(uint32(123), int32(123))
// a.EqualValues(uint32(123), int32(123))
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) EqualValues ( expected interface { } , actual interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) EqualValues ( expected interface { } , actual interface { } , msgAndArgs ... interface { } ) bool {
return EqualValues ( a . t , expected , actual , msgAndArgs ... )
return EqualValues ( a . t , expected , actual , msgAndArgs ... )
}
}
@ -114,8 +126,6 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn
// and equal.
// and equal.
//
//
// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) EqualValuesf ( expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) EqualValuesf ( expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
return EqualValuesf ( a . t , expected , actual , msg , args ... )
return EqualValuesf ( a . t , expected , actual , msg , args ... )
}
}
@ -124,8 +134,6 @@ func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg
//
//
// a.Equalf(123, 123, "error message %s", "formatted")
// a.Equalf(123, 123, "error message %s", "formatted")
//
//
// Returns whether the assertion was successful (true) or not (false).
//
// Pointer variable equality is determined based on the equality of the
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses). Function equality
// referenced values (as opposed to the memory addresses). Function equality
// cannot be determined and will always fail.
// cannot be determined and will always fail.
@ -139,8 +147,6 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string
// if a.Error(err) {
// if a.Error(err) {
// assert.Equal(t, expectedError, err)
// assert.Equal(t, expectedError, err)
// }
// }
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Error ( err error , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Error ( err error , msgAndArgs ... interface { } ) bool {
return Error ( a . t , err , msgAndArgs ... )
return Error ( a . t , err , msgAndArgs ... )
}
}
@ -151,26 +157,20 @@ func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
// if a.Errorf(err, "error message %s", "formatted") {
// if a.Errorf(err, "error message %s", "formatted") {
// assert.Equal(t, expectedErrorf, err)
// assert.Equal(t, expectedErrorf, err)
// }
// }
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Errorf ( err error , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Errorf ( err error , msg string , args ... interface { } ) bool {
return Errorf ( a . t , err , msg , args ... )
return Errorf ( a . t , err , msg , args ... )
}
}
// Exactly asserts that two objects are equal is value and type.
// Exactly asserts that two objects are equal in value and type.
//
//
// a.Exactly(int32(123), int64(123))
// a.Exactly(int32(123), int64(123))
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Exactly ( expected interface { } , actual interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Exactly ( expected interface { } , actual interface { } , msgAndArgs ... interface { } ) bool {
return Exactly ( a . t , expected , actual , msgAndArgs ... )
return Exactly ( a . t , expected , actual , msgAndArgs ... )
}
}
// Exactlyf asserts that two objects are equal is value and type.
// Exactlyf asserts that two objects are equal in value and type.
//
//
// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Exactlyf ( expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Exactlyf ( expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
return Exactlyf ( a . t , expected , actual , msg , args ... )
return Exactlyf ( a . t , expected , actual , msg , args ... )
}
}
@ -198,8 +198,6 @@ func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{
// False asserts that the specified value is false.
// False asserts that the specified value is false.
//
//
// a.False(myBool)
// a.False(myBool)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) False ( value bool , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) False ( value bool , msgAndArgs ... interface { } ) bool {
return False ( a . t , value , msgAndArgs ... )
return False ( a . t , value , msgAndArgs ... )
}
}
@ -207,20 +205,28 @@ func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
// Falsef asserts that the specified value is false.
// Falsef asserts that the specified value is false.
//
//
// a.Falsef(myBool, "error message %s", "formatted")
// a.Falsef(myBool, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Falsef ( value bool , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Falsef ( value bool , msg string , args ... interface { } ) bool {
return Falsef ( a . t , value , msg , args ... )
return Falsef ( a . t , value , msg , args ... )
}
}
// FileExists 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 ( a * Assertions ) FileExists ( path string , msgAndArgs ... interface { } ) bool {
return FileExists ( a . t , path , msgAndArgs ... )
}
// 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 ( a * Assertions ) FileExistsf ( path string , msg string , args ... interface { } ) bool {
return FileExistsf ( a . t , path , msg , args ... )
}
// HTTPBodyContains asserts that a specified handler returns a
// HTTPBodyContains asserts that a specified handler returns a
// body that contains a string.
// body that contains a string.
//
//
// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
//
// Returns whether the assertion was successful (true) or not (false).
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) HTTPBodyContains ( handler http . HandlerFunc , method string , url string , values url . Values , str interface { } ) bool {
func ( a * Assertions ) HTTPBodyContains ( handler http . HandlerFunc , method string , url string , values url . Values , str interface { } , msgAndArgs ... interface { } ) bool {
return HTTPBodyContains ( a . t , handler , method , url , values , str )
return HTTPBodyContains ( a . t , handler , method , url , values , str , msgAndArgs ... )
}
}
// HTTPBodyContainsf asserts that a specified handler returns a
// HTTPBodyContainsf asserts that a specified handler returns a
@ -229,8 +235,8 @@ func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, u
// a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
// a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
//
// Returns whether the assertion was successful (true) or not (false).
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) HTTPBodyContainsf ( handler http . HandlerFunc , method string , url string , values url . Values , str interface { } ) bool {
func ( a * Assertions ) HTTPBodyContainsf ( handler http . HandlerFunc , method string , url string , values url . Values , str interface { } , msg string , args ... interface { } ) bool {
return HTTPBodyContainsf ( a . t , handler , method , url , values , str )
return HTTPBodyContainsf ( a . t , handler , method , url , values , str , msg , args ... )
}
}
// HTTPBodyNotContains asserts that a specified handler returns a
// HTTPBodyNotContains asserts that a specified handler returns a
@ -239,8 +245,8 @@ func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string,
// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
//
//
// Returns whether the assertion was successful (true) or not (false).
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) HTTPBodyNotContains ( handler http . HandlerFunc , method string , url string , values url . Values , str interface { } ) bool {
func ( a * Assertions ) HTTPBodyNotContains ( handler http . HandlerFunc , method string , url string , values url . Values , str interface { } , msgAndArgs ... interface { } ) bool {
return HTTPBodyNotContains ( a . t , handler , method , url , values , str )
return HTTPBodyNotContains ( a . t , handler , method , url , values , str , msgAndArgs ... )
}
}
// HTTPBodyNotContainsf asserts that a specified handler returns a
// HTTPBodyNotContainsf asserts that a specified handler returns a
@ -249,8 +255,8 @@ func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string
// a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
// a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
//
//
// Returns whether the assertion was successful (true) or not (false).
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) HTTPBodyNotContainsf ( handler http . HandlerFunc , method string , url string , values url . Values , str interface { } ) bool {
func ( a * Assertions ) HTTPBodyNotContainsf ( handler http . HandlerFunc , method string , url string , values url . Values , str interface { } , msg string , args ... interface { } ) bool {
return HTTPBodyNotContainsf ( a . t , handler , method , url , values , str )
return HTTPBodyNotContainsf ( a . t , handler , method , url , values , str , msg , args ... )
}
}
// HTTPError asserts that a specified handler returns an error status code.
// HTTPError asserts that a specified handler returns an error status code.
@ -258,8 +264,8 @@ func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method strin
// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
//
// Returns whether the assertion was successful (true) or not (false).
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) HTTPError ( handler http . HandlerFunc , method string , url string , values url . Values ) bool {
func ( a * Assertions ) HTTPError ( handler http . HandlerFunc , method string , url string , values url . Values , msgAndArgs ... interface { } ) bool {
return HTTPError ( a . t , handler , method , url , values )
return HTTPError ( a . t , handler , method , url , values , msgAndArgs ... )
}
}
// HTTPErrorf asserts that a specified handler returns an error status code.
// HTTPErrorf asserts that a specified handler returns an error status code.
@ -267,8 +273,8 @@ func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url stri
// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
// a.HTTPErrorf(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).
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
func ( a * Assertions ) HTTPErrorf ( handler http . HandlerFunc , method string , url string , values url . Values ) bool {
func ( a * Assertions ) HTTPErrorf ( handler http . HandlerFunc , method string , url string , values url . Values , msg string , args ... interface { } ) bool {
return HTTPErrorf ( a . t , handler , method , url , values )
return HTTPErrorf ( a . t , handler , method , url , values , msg , args ... )
}
}
// HTTPRedirect asserts that a specified handler returns a redirect status code.
// HTTPRedirect asserts that a specified handler returns a redirect status code.
@ -276,8 +282,8 @@ func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url str
// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
//
//
// Returns whether the assertion was successful (true) or not (false).
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) HTTPRedirect ( handler http . HandlerFunc , method string , url string , values url . Values ) bool {
func ( a * Assertions ) HTTPRedirect ( handler http . HandlerFunc , method string , url string , values url . Values , msgAndArgs ... interface { } ) bool {
return HTTPRedirect ( a . t , handler , method , url , values )
return HTTPRedirect ( a . t , handler , method , url , values , msgAndArgs ... )
}
}
// HTTPRedirectf asserts that a specified handler returns a redirect status code.
// HTTPRedirectf asserts that a specified handler returns a redirect status code.
@ -285,8 +291,8 @@ func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url s
// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
// a.HTTPRedirectf(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).
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
func ( a * Assertions ) HTTPRedirectf ( handler http . HandlerFunc , method string , url string , values url . Values ) bool {
func ( a * Assertions ) HTTPRedirectf ( handler http . HandlerFunc , method string , url string , values url . Values , msg string , args ... interface { } ) bool {
return HTTPRedirectf ( a . t , handler , method , url , values )
return HTTPRedirectf ( a . t , handler , method , url , values , msg , args ... )
}
}
// HTTPSuccess asserts that a specified handler returns a success status code.
// HTTPSuccess asserts that a specified handler returns a success status code.
@ -294,8 +300,8 @@ func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url
// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
//
//
// Returns whether the assertion was successful (true) or not (false).
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) HTTPSuccess ( handler http . HandlerFunc , method string , url string , values url . Values ) bool {
func ( a * Assertions ) HTTPSuccess ( handler http . HandlerFunc , method string , url string , values url . Values , msgAndArgs ... interface { } ) bool {
return HTTPSuccess ( a . t , handler , method , url , values )
return HTTPSuccess ( a . t , handler , method , url , values , msgAndArgs ... )
}
}
// HTTPSuccessf asserts that a specified handler returns a success status code.
// HTTPSuccessf asserts that a specified handler returns a success status code.
@ -303,8 +309,8 @@ func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url st
// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
//
//
// Returns whether the assertion was successful (true) or not (false).
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) HTTPSuccessf ( handler http . HandlerFunc , method string , url string , values url . Values ) bool {
func ( a * Assertions ) HTTPSuccessf ( handler http . HandlerFunc , method string , url string , values url . Values , msg string , args ... interface { } ) bool {
return HTTPSuccessf ( a . t , handler , method , url , values )
return HTTPSuccessf ( a . t , handler , method , url , values , msg , args ... )
}
}
// Implements asserts that an object is implemented by the specified interface.
// Implements asserts that an object is implemented by the specified interface.
@ -324,12 +330,20 @@ func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}
// InDelta asserts that the two numerals are within delta of each other.
// InDelta asserts that the two numerals are within delta of each other.
//
//
// a.InDelta(math.Pi, (22 / 7.0), 0.01)
// a.InDelta(math.Pi, (22 / 7.0), 0.01)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) InDelta ( expected interface { } , actual interface { } , delta float64 , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) InDelta ( expected interface { } , actual interface { } , delta float64 , msgAndArgs ... interface { } ) bool {
return InDelta ( a . t , expected , actual , delta , msgAndArgs ... )
return InDelta ( a . t , expected , actual , delta , msgAndArgs ... )
}
}
// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
func ( a * Assertions ) InDeltaMapValues ( expected interface { } , actual interface { } , delta float64 , msgAndArgs ... interface { } ) bool {
return InDeltaMapValues ( a . t , expected , actual , delta , msgAndArgs ... )
}
// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
func ( a * Assertions ) InDeltaMapValuesf ( expected interface { } , actual interface { } , delta float64 , msg string , args ... interface { } ) bool {
return InDeltaMapValuesf ( a . t , expected , actual , delta , msg , args ... )
}
// InDeltaSlice is the same as InDelta, except it compares two slices.
// InDeltaSlice is the same as InDelta, except it compares two slices.
func ( a * Assertions ) InDeltaSlice ( expected interface { } , actual interface { } , delta float64 , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) InDeltaSlice ( expected interface { } , actual interface { } , delta float64 , msgAndArgs ... interface { } ) bool {
return InDeltaSlice ( a . t , expected , actual , delta , msgAndArgs ... )
return InDeltaSlice ( a . t , expected , actual , delta , msgAndArgs ... )
@ -343,15 +357,11 @@ func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, del
// InDeltaf asserts that the two numerals are within delta of each other.
// InDeltaf asserts that the two numerals are within delta of each other.
//
//
// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) InDeltaf ( expected interface { } , actual interface { } , delta float64 , msg string , args ... interface { } ) bool {
func ( a * Assertions ) InDeltaf ( expected interface { } , actual interface { } , delta float64 , msg string , args ... interface { } ) bool {
return InDeltaf ( a . t , expected , actual , delta , msg , args ... )
return InDeltaf ( a . t , expected , actual , delta , msg , args ... )
}
}
// InEpsilon asserts that expected and actual have a relative error less than epsilon
// InEpsilon asserts that expected and actual have a relative error less than epsilon
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) InEpsilon ( expected interface { } , actual interface { } , epsilon float64 , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) InEpsilon ( expected interface { } , actual interface { } , epsilon float64 , msgAndArgs ... interface { } ) bool {
return InEpsilon ( a . t , expected , actual , epsilon , msgAndArgs ... )
return InEpsilon ( a . t , expected , actual , epsilon , msgAndArgs ... )
}
}
@ -367,8 +377,6 @@ func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, e
}
}
// InEpsilonf asserts that expected and actual have a relative error less than epsilon
// InEpsilonf asserts that expected and actual have a relative error less than epsilon
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) InEpsilonf ( expected interface { } , actual interface { } , epsilon float64 , msg string , args ... interface { } ) bool {
func ( a * Assertions ) InEpsilonf ( expected interface { } , actual interface { } , epsilon float64 , msg string , args ... interface { } ) bool {
return InEpsilonf ( a . t , expected , actual , epsilon , msg , args ... )
return InEpsilonf ( a . t , expected , actual , epsilon , msg , args ... )
}
}
@ -386,8 +394,6 @@ func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg s
// JSONEq asserts that two JSON strings are equivalent.
// JSONEq asserts that two JSON strings are equivalent.
//
//
// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) JSONEq ( expected string , actual string , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) JSONEq ( expected string , actual string , msgAndArgs ... interface { } ) bool {
return JSONEq ( a . t , expected , actual , msgAndArgs ... )
return JSONEq ( a . t , expected , actual , msgAndArgs ... )
}
}
@ -395,8 +401,6 @@ func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interf
// JSONEqf asserts that two JSON strings are equivalent.
// JSONEqf asserts that two JSON strings are equivalent.
//
//
// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) JSONEqf ( expected string , actual string , msg string , args ... interface { } ) bool {
func ( a * Assertions ) JSONEqf ( expected string , actual string , msg string , args ... interface { } ) bool {
return JSONEqf ( a . t , expected , actual , msg , args ... )
return JSONEqf ( a . t , expected , actual , msg , args ... )
}
}
@ -405,8 +409,6 @@ func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ..
// Len also fails if the object has a type that len() not accept.
// Len also fails if the object has a type that len() not accept.
//
//
// a.Len(mySlice, 3)
// a.Len(mySlice, 3)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Len ( object interface { } , length int , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Len ( object interface { } , length int , msgAndArgs ... interface { } ) bool {
return Len ( a . t , object , length , msgAndArgs ... )
return Len ( a . t , object , length , msgAndArgs ... )
}
}
@ -415,8 +417,6 @@ func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface
// Lenf also fails if the object has a type that len() not accept.
// Lenf also fails if the object has a type that len() not accept.
//
//
// a.Lenf(mySlice, 3, "error message %s", "formatted")
// a.Lenf(mySlice, 3, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Lenf ( object interface { } , length int , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Lenf ( object interface { } , length int , msg string , args ... interface { } ) bool {
return Lenf ( a . t , object , length , msg , args ... )
return Lenf ( a . t , object , length , msg , args ... )
}
}
@ -424,8 +424,6 @@ func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...in
// Nil asserts that the specified object is nil.
// Nil asserts that the specified object is nil.
//
//
// a.Nil(err)
// a.Nil(err)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Nil ( object interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Nil ( object interface { } , msgAndArgs ... interface { } ) bool {
return Nil ( a . t , object , msgAndArgs ... )
return Nil ( a . t , object , msgAndArgs ... )
}
}
@ -433,8 +431,6 @@ func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {
// Nilf asserts that the specified object is nil.
// Nilf asserts that the specified object is nil.
//
//
// a.Nilf(err, "error message %s", "formatted")
// a.Nilf(err, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Nilf ( object interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Nilf ( object interface { } , msg string , args ... interface { } ) bool {
return Nilf ( a . t , object , msg , args ... )
return Nilf ( a . t , object , msg , args ... )
}
}
@ -445,8 +441,6 @@ func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) b
// if a.NoError(err) {
// if a.NoError(err) {
// assert.Equal(t, expectedObj, actualObj)
// assert.Equal(t, expectedObj, actualObj)
// }
// }
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NoError ( err error , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NoError ( err error , msgAndArgs ... interface { } ) bool {
return NoError ( a . t , err , msgAndArgs ... )
return NoError ( a . t , err , msgAndArgs ... )
}
}
@ -457,8 +451,6 @@ func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
// if a.NoErrorf(err, "error message %s", "formatted") {
// if a.NoErrorf(err, "error message %s", "formatted") {
// assert.Equal(t, expectedObj, actualObj)
// assert.Equal(t, expectedObj, actualObj)
// }
// }
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NoErrorf ( err error , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NoErrorf ( err error , msg string , args ... interface { } ) bool {
return NoErrorf ( a . t , err , msg , args ... )
return NoErrorf ( a . t , err , msg , args ... )
}
}
@ -469,8 +461,6 @@ func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {
// a.NotContains("Hello World", "Earth")
// a.NotContains("Hello World", "Earth")
// a.NotContains(["Hello", "World"], "Earth")
// a.NotContains(["Hello", "World"], "Earth")
// a.NotContains({"Hello": "World"}, "Earth")
// a.NotContains({"Hello": "World"}, "Earth")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotContains ( s interface { } , contains interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NotContains ( s interface { } , contains interface { } , msgAndArgs ... interface { } ) bool {
return NotContains ( a . t , s , contains , msgAndArgs ... )
return NotContains ( a . t , s , contains , msgAndArgs ... )
}
}
@ -481,8 +471,6 @@ func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs
// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotContainsf ( s interface { } , contains interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NotContainsf ( s interface { } , contains interface { } , msg string , args ... interface { } ) bool {
return NotContainsf ( a . t , s , contains , msg , args ... )
return NotContainsf ( a . t , s , contains , msg , args ... )
}
}
@ -493,8 +481,6 @@ func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg strin
// if a.NotEmpty(obj) {
// if a.NotEmpty(obj) {
// assert.Equal(t, "two", obj[1])
// assert.Equal(t, "two", obj[1])
// }
// }
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotEmpty ( object interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NotEmpty ( object interface { } , msgAndArgs ... interface { } ) bool {
return NotEmpty ( a . t , object , msgAndArgs ... )
return NotEmpty ( a . t , object , msgAndArgs ... )
}
}
@ -505,8 +491,6 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) boo
// if a.NotEmptyf(obj, "error message %s", "formatted") {
// if a.NotEmptyf(obj, "error message %s", "formatted") {
// assert.Equal(t, "two", obj[1])
// assert.Equal(t, "two", obj[1])
// }
// }
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotEmptyf ( object interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NotEmptyf ( object interface { } , msg string , args ... interface { } ) bool {
return NotEmptyf ( a . t , object , msg , args ... )
return NotEmptyf ( a . t , object , msg , args ... )
}
}
@ -515,8 +499,6 @@ func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface
//
//
// a.NotEqual(obj1, obj2)
// a.NotEqual(obj1, obj2)
//
//
// Returns whether the assertion was successful (true) or not (false).
//
// Pointer variable equality is determined based on the equality of the
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
// referenced values (as opposed to the memory addresses).
func ( a * Assertions ) NotEqual ( expected interface { } , actual interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NotEqual ( expected interface { } , actual interface { } , msgAndArgs ... interface { } ) bool {
@ -527,8 +509,6 @@ func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndAr
//
//
// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
//
//
// Returns whether the assertion was successful (true) or not (false).
//
// Pointer variable equality is determined based on the equality of the
// Pointer variable equality is determined based on the equality of the
// referenced values (as opposed to the memory addresses).
// referenced values (as opposed to the memory addresses).
func ( a * Assertions ) NotEqualf ( expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NotEqualf ( expected interface { } , actual interface { } , msg string , args ... interface { } ) bool {
@ -538,8 +518,6 @@ func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg str
// NotNil asserts that the specified object is not nil.
// NotNil asserts that the specified object is not nil.
//
//
// a.NotNil(err)
// a.NotNil(err)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotNil ( object interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NotNil ( object interface { } , msgAndArgs ... interface { } ) bool {
return NotNil ( a . t , object , msgAndArgs ... )
return NotNil ( a . t , object , msgAndArgs ... )
}
}
@ -547,8 +525,6 @@ func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool
// NotNilf asserts that the specified object is not nil.
// NotNilf asserts that the specified object is not nil.
//
//
// a.NotNilf(err, "error message %s", "formatted")
// a.NotNilf(err, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotNilf ( object interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NotNilf ( object interface { } , msg string , args ... interface { } ) bool {
return NotNilf ( a . t , object , msg , args ... )
return NotNilf ( a . t , object , msg , args ... )
}
}
@ -556,8 +532,6 @@ func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}
// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
//
//
// a.NotPanics(func(){ RemainCalm() })
// a.NotPanics(func(){ RemainCalm() })
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotPanics ( f PanicTestFunc , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NotPanics ( f PanicTestFunc , msgAndArgs ... interface { } ) bool {
return NotPanics ( a . t , f , msgAndArgs ... )
return NotPanics ( a . t , f , msgAndArgs ... )
}
}
@ -565,8 +539,6 @@ func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool
// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
//
//
// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotPanicsf ( f PanicTestFunc , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NotPanicsf ( f PanicTestFunc , msg string , args ... interface { } ) bool {
return NotPanicsf ( a . t , f , msg , args ... )
return NotPanicsf ( a . t , f , msg , args ... )
}
}
@ -575,8 +547,6 @@ func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}
//
//
// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
// a.NotRegexp("^start", "it's not starting")
// a.NotRegexp("^start", "it's not starting")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotRegexp ( rx interface { } , str interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NotRegexp ( rx interface { } , str interface { } , msgAndArgs ... interface { } ) bool {
return NotRegexp ( a . t , rx , str , msgAndArgs ... )
return NotRegexp ( a . t , rx , str , msgAndArgs ... )
}
}
@ -585,8 +555,6 @@ func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...in
//
//
// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotRegexpf ( rx interface { } , str interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NotRegexpf ( rx interface { } , str interface { } , msg string , args ... interface { } ) bool {
return NotRegexpf ( a . t , rx , str , msg , args ... )
return NotRegexpf ( a . t , rx , str , msg , args ... )
}
}
@ -595,8 +563,6 @@ func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, arg
// elements given in the specified subset(array, slice...).
// elements given in the specified subset(array, slice...).
//
//
// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotSubset ( list interface { } , subset interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NotSubset ( list interface { } , subset interface { } , msgAndArgs ... interface { } ) bool {
return NotSubset ( a . t , list , subset , msgAndArgs ... )
return NotSubset ( a . t , list , subset , msgAndArgs ... )
}
}
@ -605,18 +571,16 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs
// elements given in the specified subset(array, slice...).
// elements given in the specified subset(array, slice...).
//
//
// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) NotSubsetf ( list interface { } , subset interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NotSubsetf ( list interface { } , subset interface { } , msg string , args ... interface { } ) bool {
return NotSubsetf ( a . t , list , subset , msg , args ... )
return NotSubsetf ( a . t , list , subset , msg , args ... )
}
}
// NotZero asserts that i is not the zero value for its type and returns the truth .
// NotZero asserts that i is not the zero value for its type.
func ( a * Assertions ) NotZero ( i interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) NotZero ( i interface { } , msgAndArgs ... interface { } ) bool {
return NotZero ( a . t , i , msgAndArgs ... )
return NotZero ( a . t , i , msgAndArgs ... )
}
}
// NotZerof asserts that i is not the zero value for its type and returns the truth .
// NotZerof asserts that i is not the zero value for its type.
func ( a * Assertions ) NotZerof ( i interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) NotZerof ( i interface { } , msg string , args ... interface { } ) bool {
return NotZerof ( a . t , i , msg , args ... )
return NotZerof ( a . t , i , msg , args ... )
}
}
@ -624,8 +588,6 @@ func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bo
// Panics asserts that the code inside the specified PanicTestFunc panics.
// Panics asserts that the code inside the specified PanicTestFunc panics.
//
//
// a.Panics(func(){ GoCrazy() })
// a.Panics(func(){ GoCrazy() })
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Panics ( f PanicTestFunc , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Panics ( f PanicTestFunc , msgAndArgs ... interface { } ) bool {
return Panics ( a . t , f , msgAndArgs ... )
return Panics ( a . t , f , msgAndArgs ... )
}
}
@ -634,8 +596,6 @@ func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
// the recovered panic value equals the expected panic value.
// the recovered panic value equals the expected panic value.
//
//
// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) PanicsWithValue ( expected interface { } , f PanicTestFunc , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) PanicsWithValue ( expected interface { } , f PanicTestFunc , msgAndArgs ... interface { } ) bool {
return PanicsWithValue ( a . t , expected , f , msgAndArgs ... )
return PanicsWithValue ( a . t , expected , f , msgAndArgs ... )
}
}
@ -644,8 +604,6 @@ func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgA
// the recovered panic value equals the expected panic value.
// the recovered panic value equals the expected panic value.
//
//
// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) PanicsWithValuef ( expected interface { } , f PanicTestFunc , msg string , args ... interface { } ) bool {
func ( a * Assertions ) PanicsWithValuef ( expected interface { } , f PanicTestFunc , msg string , args ... interface { } ) bool {
return PanicsWithValuef ( a . t , expected , f , msg , args ... )
return PanicsWithValuef ( a . t , expected , f , msg , args ... )
}
}
@ -653,8 +611,6 @@ func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg
// Panicsf asserts that the code inside the specified PanicTestFunc panics.
// Panicsf asserts that the code inside the specified PanicTestFunc panics.
//
//
// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Panicsf ( f PanicTestFunc , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Panicsf ( f PanicTestFunc , msg string , args ... interface { } ) bool {
return Panicsf ( a . t , f , msg , args ... )
return Panicsf ( a . t , f , msg , args ... )
}
}
@ -663,8 +619,6 @@ func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) b
//
//
// a.Regexp(regexp.MustCompile("start"), "it's starting")
// a.Regexp(regexp.MustCompile("start"), "it's starting")
// a.Regexp("start...$", "it's not starting")
// a.Regexp("start...$", "it's not starting")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Regexp ( rx interface { } , str interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Regexp ( rx interface { } , str interface { } , msgAndArgs ... interface { } ) bool {
return Regexp ( a . t , rx , str , msgAndArgs ... )
return Regexp ( a . t , rx , str , msgAndArgs ... )
}
}
@ -673,8 +627,6 @@ func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...inter
//
//
// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Regexpf ( rx interface { } , str interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Regexpf ( rx interface { } , str interface { } , msg string , args ... interface { } ) bool {
return Regexpf ( a . t , rx , str , msg , args ... )
return Regexpf ( a . t , rx , str , msg , args ... )
}
}
@ -683,8 +635,6 @@ func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args .
// elements given in the specified subset(array, slice...).
// elements given in the specified subset(array, slice...).
//
//
// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Subset ( list interface { } , subset interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Subset ( list interface { } , subset interface { } , msgAndArgs ... interface { } ) bool {
return Subset ( a . t , list , subset , msgAndArgs ... )
return Subset ( a . t , list , subset , msgAndArgs ... )
}
}
@ -693,8 +643,6 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...
// elements given in the specified subset(array, slice...).
// elements given in the specified subset(array, slice...).
//
//
// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Subsetf ( list interface { } , subset interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Subsetf ( list interface { } , subset interface { } , msg string , args ... interface { } ) bool {
return Subsetf ( a . t , list , subset , msg , args ... )
return Subsetf ( a . t , list , subset , msg , args ... )
}
}
@ -702,8 +650,6 @@ func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, a
// True asserts that the specified value is true.
// True asserts that the specified value is true.
//
//
// a.True(myBool)
// a.True(myBool)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) True ( value bool , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) True ( value bool , msgAndArgs ... interface { } ) bool {
return True ( a . t , value , msgAndArgs ... )
return True ( a . t , value , msgAndArgs ... )
}
}
@ -711,8 +657,6 @@ func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
// Truef asserts that the specified value is true.
// Truef asserts that the specified value is true.
//
//
// a.Truef(myBool, "error message %s", "formatted")
// a.Truef(myBool, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) Truef ( value bool , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Truef ( value bool , msg string , args ... interface { } ) bool {
return Truef ( a . t , value , msg , args ... )
return Truef ( a . t , value , msg , args ... )
}
}
@ -720,8 +664,6 @@ func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {
// WithinDuration asserts that the two times are within duration delta of each other.
// WithinDuration asserts that the two times are within duration delta of each other.
//
//
// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) WithinDuration ( expected time . Time , actual time . Time , delta time . Duration , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) WithinDuration ( expected time . Time , actual time . Time , delta time . Duration , msgAndArgs ... interface { } ) bool {
return WithinDuration ( a . t , expected , actual , delta , msgAndArgs ... )
return WithinDuration ( a . t , expected , actual , delta , msgAndArgs ... )
}
}
@ -729,18 +671,16 @@ func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta
// WithinDurationf asserts that the two times are within duration delta of each other.
// WithinDurationf asserts that the two times are within duration delta of each other.
//
//
// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
//
// Returns whether the assertion was successful (true) or not (false).
func ( a * Assertions ) WithinDurationf ( expected time . Time , actual time . Time , delta time . Duration , msg string , args ... interface { } ) bool {
func ( a * Assertions ) WithinDurationf ( expected time . Time , actual time . Time , delta time . Duration , msg string , args ... interface { } ) bool {
return WithinDurationf ( a . t , expected , actual , delta , msg , args ... )
return WithinDurationf ( a . t , expected , actual , delta , msg , args ... )
}
}
// Zero asserts that i is the zero value for its type and returns the truth .
// Zero asserts that i is the zero value for its type.
func ( a * Assertions ) Zero ( i interface { } , msgAndArgs ... interface { } ) bool {
func ( a * Assertions ) Zero ( i interface { } , msgAndArgs ... interface { } ) bool {
return Zero ( a . t , i , msgAndArgs ... )
return Zero ( a . t , i , msgAndArgs ... )
}
}
// Zerof asserts that i is the zero value for its type and returns the truth .
// Zerof asserts that i is the zero value for its type.
func ( a * Assertions ) Zerof ( i interface { } , msg string , args ... interface { } ) bool {
func ( a * Assertions ) Zerof ( i interface { } , msg string , args ... interface { } ) bool {
return Zerof ( a . t , i , msg , args ... )
return Zerof ( a . t , i , msg , args ... )
}
}