Documentation
¶
Overview ¶
Package assert lets you use `github.com/stretchr/testify/assert` outside of tests.
The idea is to spread assertion code all over your code base while developing and have the assertions panic, if they fail.
This allows for fast development.
For production code, you compile with
go build -tags production
and the assertion code will be optimized away.
All methods of `github.com/stretchr/testify/assert#Assertions` are copied as toplevel functions of this packages. They will just return true, when your program is compiled with the `production` flag and panic, if an assertion fails otherwise.
For documentation of the functions see https://pkg.go.dev/github.com/stretchr/testify/assert#Assertions
Index ¶
- func Condition(comp assert.Comparison, msgAndArgs ...interface{}) bool
- func Conditionf(comp assert.Comparison, msg string, args ...interface{}) bool
- func Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool
- func Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool
- func DirExists(path string, msgAndArgs ...interface{}) bool
- func DirExistsf(path string, msg string, args ...interface{}) bool
- func ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool
- func ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool
- func Empty(object interface{}, msgAndArgs ...interface{}) bool
- func Emptyf(object interface{}, msg string, args ...interface{}) bool
- func Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func EqualError(theError error, errString string, msgAndArgs ...interface{}) bool
- func EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool
- func EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func Error(err error, msgAndArgs ...interface{}) bool
- func ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool
- func ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool
- func ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool
- func ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool
- func ErrorIs(err error, target error, msgAndArgs ...interface{}) bool
- func ErrorIsf(err error, target error, msg string, args ...interface{}) bool
- func Errorf(err error, msg string, args ...interface{}) bool
- func Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, ...) bool
- func EventuallyWithT(condition func(collect *assert.CollectT), waitFor time.Duration, ...) bool
- func EventuallyWithTf(condition func(collect *assert.CollectT), waitFor time.Duration, ...) bool
- func Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, ...) bool
- func Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func Fail(failureMessage string, msgAndArgs ...interface{}) bool
- func FailNow(failureMessage string, msgAndArgs ...interface{}) bool
- func FailNowf(failureMessage string, msg string, args ...interface{}) bool
- func Failf(failureMessage string, msg string, args ...interface{}) bool
- func False(value bool, msgAndArgs ...interface{}) bool
- func Falsef(value bool, msg string, args ...interface{}) bool
- func FileExists(path string, msgAndArgs ...interface{}) bool
- func FileExistsf(path string, msg string, args ...interface{}) bool
- func Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool
- func GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool
- func Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool
- func HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, ...) bool
- func Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool
- func Implementsf(interfaceObject interface{}, object interface{}, msg string, ...) bool
- func InDelta(expected interface{}, actual interface{}, delta float64, ...) bool
- func InDeltaMapValues(expected interface{}, actual interface{}, delta float64, ...) bool
- func InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, ...) bool
- func InDeltaSlice(expected interface{}, actual interface{}, delta float64, ...) bool
- func InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, ...) bool
- func InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, ...) bool
- func InEpsilon(expected interface{}, actual interface{}, epsilon float64, ...) bool
- func InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, ...) bool
- func InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, ...) bool
- func InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, ...) bool
- func IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool
- func IsDecreasingf(object interface{}, msg string, args ...interface{}) bool
- func IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool
- func IsIncreasingf(object interface{}, msg string, args ...interface{}) bool
- func IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool
- func IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool
- func IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool
- func IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool
- func IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool
- func IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool
- func JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool
- func JSONEqf(expected string, actual string, msg string, args ...interface{}) bool
- func Len(object interface{}, length int, msgAndArgs ...interface{}) bool
- func Lenf(object interface{}, length int, msg string, args ...interface{}) bool
- func Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool
- func LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool
- func LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool
- func Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool
- func Negative(e interface{}, msgAndArgs ...interface{}) bool
- func Negativef(e interface{}, msg string, args ...interface{}) bool
- func Never(condition func() bool, waitFor time.Duration, tick time.Duration, ...) bool
- func Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, ...) bool
- func Nil(object interface{}, msgAndArgs ...interface{}) bool
- func Nilf(object interface{}, msg string, args ...interface{}) bool
- func NoDirExists(path string, msgAndArgs ...interface{}) bool
- func NoDirExistsf(path string, msg string, args ...interface{}) bool
- func NoError(err error, msgAndArgs ...interface{}) bool
- func NoErrorf(err error, msg string, args ...interface{}) bool
- func NoFileExists(path string, msgAndArgs ...interface{}) bool
- func NoFileExistsf(path string, msg string, args ...interface{}) bool
- func NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool
- func NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool
- func NotEmpty(object interface{}, msgAndArgs ...interface{}) bool
- func NotEmptyf(object interface{}, msg string, args ...interface{}) bool
- func NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool
- func NotErrorIsf(err error, target error, msg string, args ...interface{}) bool
- func NotNil(object interface{}, msgAndArgs ...interface{}) bool
- func NotNilf(object interface{}, msg string, args ...interface{}) bool
- func NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
- func NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) bool
- func NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool
- func NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool
- func NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool
- func NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool
- func NotZero(i interface{}, msgAndArgs ...interface{}) bool
- func NotZerof(i interface{}, msg string, args ...interface{}) bool
- func Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
- func PanicsWithError(errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
- func PanicsWithErrorf(errString string, f assert.PanicTestFunc, msg string, args ...interface{}) bool
- func PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
- func PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) bool
- func Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) bool
- func Positive(e interface{}, msgAndArgs ...interface{}) bool
- func Positivef(e interface{}, msg string, args ...interface{}) bool
- func Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool
- func Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool
- func Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
- func Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool
- func Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool
- func True(value bool, msgAndArgs ...interface{}) bool
- func Truef(value bool, msg string, args ...interface{}) bool
- func WithinDuration(expected time.Time, actual time.Time, delta time.Duration, ...) bool
- func WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, ...) bool
- func WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool
- func WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, ...) bool
- func YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool
- func YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool
- func Zero(i interface{}, msgAndArgs ...interface{}) bool
- func Zerof(i interface{}, msg string, args ...interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Condition ¶
func Condition(comp assert.Comparison, msgAndArgs ...interface{}) bool
func Conditionf ¶
func Conditionf(comp assert.Comparison, msg string, args ...interface{}) bool
func DirExistsf ¶
func ElementsMatch ¶
func ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool
func ElementsMatchf ¶
func EqualError ¶
func EqualErrorf ¶
func EqualExportedValues ¶
func EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func EqualExportedValuesf ¶
func EqualValues ¶
func EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func EqualValuesf ¶
func ErrorContains ¶
func ErrorContainsf ¶
func Eventually ¶
func EventuallyWithT ¶
func EventuallyWithTf ¶
func Eventuallyf ¶
func Exactly ¶
func Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func FileExists ¶
func FileExistsf ¶
func GreaterOrEqualf ¶
func HTTPBodyContains ¶
func HTTPBodyContainsf ¶
func HTTPBodyNotContains ¶
func HTTPBodyNotContainsf ¶
func HTTPErrorf ¶
func HTTPRedirect ¶
func HTTPRedirectf ¶
func HTTPStatusCode ¶
func HTTPStatusCodef ¶
func HTTPSuccess ¶
func HTTPSuccessf ¶
func Implements ¶
func Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool
func Implementsf ¶
func InDeltaMapValues ¶
func InDeltaMapValuesf ¶
func InDeltaSlice ¶
func InDeltaSlicef ¶
func InEpsilonSlice ¶
func InEpsilonSlicef ¶
func InEpsilonf ¶
func IsDecreasing ¶
func IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool
func IsDecreasingf ¶
func IsIncreasing ¶
func IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool
func IsIncreasingf ¶
func IsNonDecreasing ¶
func IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool
func IsNonDecreasingf ¶
func IsNonIncreasing ¶
func IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool
func IsNonIncreasingf ¶
func IsType ¶
func IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool
func LessOrEqual ¶
func LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool
func LessOrEqualf ¶
func NoDirExists ¶
func NoDirExistsf ¶
func NoFileExists ¶
func NoFileExistsf ¶
func NotContains ¶
func NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool
func NotContainsf ¶
func NotEqual ¶
func NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func NotEqualValues ¶
func NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func NotEqualValuesf ¶
func NotErrorIs ¶
func NotPanics ¶
func NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
func NotPanicsf ¶
func NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) bool
func NotRegexpf ¶
func NotSame ¶
func NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool
func NotSubset ¶
func NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool
func NotSubsetf ¶
func Panics ¶
func Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
func PanicsWithError ¶
func PanicsWithError(errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
func PanicsWithErrorf ¶
func PanicsWithErrorf(errString string, f assert.PanicTestFunc, msg string, args ...interface{}) bool
func PanicsWithValue ¶
func PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
func PanicsWithValuef ¶
func PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) bool
func WithinDuration ¶
func WithinDurationf ¶
func WithinRange ¶
func WithinRangef ¶
Types ¶
This section is empty.