Versions in this module Expand all Collapse all v1 v1.5.2 Sep 15, 2023 v1.5.1 Sep 15, 2023 Changes in this version + var AnError = errors.New("assert.AnError general error for testing") + func CallerInfo() []string + func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool + func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool + func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool + func Containsf(t TestingT, s interface{}, contains interface{}, msg string, ...) bool + func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool + func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool + func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) + func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, ...) bool + func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool + func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool + func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool + func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool + func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool + func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool + func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool + func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool + func Error(t TestingT, err error, msgAndArgs ...interface{}) bool + func Errorf(t TestingT, err error, msg string, args ...interface{}) bool + func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, ...) bool + func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, ...) bool + func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool + func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool + func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool + func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool + func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool + func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool + func False(t TestingT, value bool, msgAndArgs ...interface{}) bool + func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool + func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool + func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool + func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool + func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool + func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool + func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool + func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string + func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, ...) bool + func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool + func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, ...) bool + func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool + func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, ...) bool + func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool + func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, ...) bool + func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool + func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, ...) bool + func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, ...) bool + func Implements(t TestingT, interfaceObject interface{}, object interface{}, ...) bool + func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, ...) bool + func InDelta(t TestingT, expected, actual interface{}, delta float64, ...) bool + func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, ...) bool + func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, ...) bool + func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, ...) bool + func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, ...) bool + func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, ...) bool + func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, ...) bool + func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, ...) bool + func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, ...) bool + func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, ...) bool + func IsType(t TestingT, expectedType interface{}, object interface{}, ...) bool + func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, ...) bool + func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool + func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool + func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool + func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool + func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool + func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool + func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool + func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool + func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, ...) bool + func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, ...) bool + func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool + func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool + func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool + func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool + func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool + func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool + func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool + func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool + func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool + func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, ...) bool + func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool + func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool + func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool + func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool + func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool + func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool + func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool + func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool + func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool + func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool + func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool + func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool + func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) + func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, ...) bool + func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool + func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool + func ObjectsAreEqual(expected, actual interface{}) bool + func ObjectsAreEqualValues(expected, actual interface{}) bool + func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool + func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool + func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool + func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool + func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, ...) bool + func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool + func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool + func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool + func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool + func Samef(t TestingT, expected interface{}, actual interface{}, msg string, ...) bool + func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) + func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, ...) bool + func True(t TestingT, value bool, msgAndArgs ...interface{}) bool + func Truef(t TestingT, value bool, msg string, args ...interface{}) bool + func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, ...) bool + func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, ...) bool + func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool + func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool + func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool + func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool + type Assertions struct + func New(t TestingT) *Assertions + func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool + func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool + func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool + func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool + func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool + func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool + func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool + func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool + func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool + func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, ...) bool + func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, ...) bool + func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool + func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool + func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool + func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool + func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool + func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool + func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool + func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool + func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool + func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool + func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool + func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool + func (a *Assertions) HTTPBodyNotContainsf(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, ...) bool + func (a *Assertions) HTTPErrorf(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, ...) bool + func (a *Assertions) HTTPRedirectf(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, ...) bool + func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool + func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, ...) bool + func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, ...) bool + func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, ...) bool + func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, ...) bool + func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, ...) bool + func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, ...) bool + func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, ...) bool + func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, ...) bool + func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, ...) bool + func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, ...) bool + func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, ...) bool + func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool + func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool + func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool + func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool + func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool + func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, ...) bool + func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, ...) bool + func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool + func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool + func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool + func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool + func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool + func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool + func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool + func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool + func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool + func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool + func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool + func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool + func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool + func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool + func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool + func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool + func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool + func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool + func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool + func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool + func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool + func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool + func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool + func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool + func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool + func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool + func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, ...) bool + func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, ...) bool + func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool + func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool + func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool + func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool + type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool + type Comparison func() (success bool) + type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool + type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool + type PanicTestFunc func() + type TestingT interface + Errorf func(format string, args ...interface{}) + type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool