Documentation
¶
Overview ¶
Package assert is a minimalistic drop-in replacement for testify/assert. It is based on fortio.org/assert and is internal to this module.
Index ¶
- func Assert(t testing.TB, cond bool, msg string, rest ...any)
- func CheckEquals(t testing.TB, actual, expected any, msg ...any)
- func Contains(t testing.TB, haystack, needle any, msg ...any)
- func Empty(t testing.TB, value any, msg ...any)
- func Equal(t testing.TB, a, b any, msg ...any)
- func EqualValues(t testing.TB, a, b any, msg ...any)
- func Error(t testing.TB, err error, msg ...any)
- func ErrorContains(t testing.TB, err error, want string, msg ...any)
- func ErrorIs(t testing.TB, err, target error, msg ...any)
- func Errorf(t testing.TB, format string, rest ...any)
- func Fail(t testing.TB, msg string, args ...any)
- func False(t testing.TB, b bool, msg ...any)
- func Greater(t testing.TB, actual, expected any, msg ...any)
- func IsIncreasing(t testing.TB, value any, msg ...any)
- func Len(t testing.TB, value any, expected int, msg ...any)
- func Nil(t testing.TB, value any, msg ...any)
- func NoError(t testing.TB, err error, msg ...any)
- func NotContains(t testing.TB, haystack, needle any, msg ...any)
- func NotEmpty(t testing.TB, value any, msg ...any)
- func NotEqual(t testing.TB, a, b any, msg ...any)
- func NotNil(t testing.TB, value any, msg ...any)
- func ObjectsAreEqualValues(a, b any) bool
- func Run(t *testing.T, suite hasT)
- func True(t testing.TB, b bool, msg ...any)
- type TestSuite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
Assert is similar to True() under a different name and earlier fortio/stats test implementation.
func CheckEquals ¶
CheckEquals checks if actual == expect and fails the test and logs failure (including filename:linenum if they are not equal).
func EqualValues ¶
EqualValues checks for a equal b.
func ErrorContains ¶
ErrorContains checks that err is non-nil and its message contains want.
func IsIncreasing ¶
IsIncreasing checks that every item is greater than the item before it.
func NotContains ¶
NotContains checks that needle is not in haystack.
func ObjectsAreEqualValues ¶
ObjectsAreEqualValues returns true if a == b (through refection).
func Run ¶
Run runs the test suite with SetupTest first and TearDownTest after. Replaces https://pkg.go.dev/github.com/stretchr/testify/suite#Run.
Types ¶
type TestSuite ¶
type TestSuite struct {
// contains filtered or unexported fields
}
TestSuite to be used as base struct for test suites. Replaces https://pkg.go.dev/github.com/stretchr/testify@v1.8.0/suite.