Documentation ¶
Index ¶
- func Equal[V comparable](tt TestingIface, want, got V, msgAndArgs ...any) bool
- func EqualAny(tt TestingIface, want, got any, msgAndArgs ...any) bool
- func EqualAnyf(tt TestingIface, want, got any, msg string, args ...any) bool
- func Error(tt TestingIface, err error, msgAndArgs ...any) bool
- func ErrorIs(tt TestingIface, err, target error, msgAndArgs ...any) bool
- func False(tt TestingIface, value bool, msgAndArgs ...any) bool
- func HasPrefix(tt TestingIface, s, prefix string, msgAndArgs ...any) bool
- func HasSuffix(tt TestingIface, s, suffix string, msgAndArgs ...any) bool
- func KeyValErrorMsg(key string, val any) string
- func Nil(tt TestingIface, value any, msgAndArgs ...any) bool
- func NoError(ti TestingIface, err error, msgAndArgs ...any) bool
- func NotEqual[V comparable](tt TestingIface, want, got V, msgAndArgs ...any) bool
- func NotNil(tt TestingIface, value any, msgAndArgs ...any) bool
- func ObjectsAreEqual(expected, actual interface{}) bool
- func True(tt TestingIface, value bool, msgAndArgs ...any) bool
- type Data
- type Result
- type Results
- type TestingIface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
func Equal[V comparable](tt TestingIface, want, got V, msgAndArgs ...any) bool
Equal asserts comparables.
testutils.Equal(t, "hello", "hello")
func Error ¶
func Error(tt TestingIface, err error, msgAndArgs ...any) bool
Error assert that err != nil
func ErrorIs ¶
func ErrorIs(tt TestingIface, err, target error, msgAndArgs ...any) bool
ErrorIs asserts errors.Is(err, target)
func False ¶
func False(tt TestingIface, value bool, msgAndArgs ...any) bool
False asserts that the specified value is false.
testutils.False(t, myBool)
func HasPrefix ¶ added in v0.5.0
func HasPrefix(tt TestingIface, s, prefix string, msgAndArgs ...any) bool
func HasSuffix ¶ added in v0.5.0
func HasSuffix(tt TestingIface, s, suffix string, msgAndArgs ...any) bool
func KeyValErrorMsg ¶
func Nil ¶
func Nil(tt TestingIface, value any, msgAndArgs ...any) bool
Nil asserts that the specified value is nil.
func NoError ¶
func NoError(ti TestingIface, err error, msgAndArgs ...any) bool
NoError asserts that a function returned no error (i.e. `nil`).
actualObj, err := SomeFunction() if testutils.NoError(t, err) { testutils.Equal(t, expectedObj, actualObj) }
func NotEqual ¶
func NotEqual[V comparable](tt TestingIface, want, got V, msgAndArgs ...any) bool
func NotNil ¶
func NotNil(tt TestingIface, value any, msgAndArgs ...any) bool
NotNil asserts that the specified value is not nil.
testutils.NotNil(t, &val)
func ObjectsAreEqual ¶
func ObjectsAreEqual(expected, actual interface{}) bool
ObjectsAreEqual determines if two objects are considered equal.
This function does no assertion of any kind.
Types ¶
type Result ¶ added in v0.6.0
type Result[T comparable] struct { Title string Want T Got T }
type Results ¶ added in v0.6.0
type Results[T comparable] []Result[T]
func NewResults ¶ added in v0.6.0
func NewResults[T comparable]() Results[T]
func (Results[T]) Test ¶ added in v0.6.0
func (td Results[T]) Test(ti TestingIface)
type TestingIface ¶
TestingIface is an interface wrapper for *testing.T, *testing.B, *testing.F
Click to show internal directories.
Click to hide internal directories.