Documentation ¶
Index ¶
- func Equal[V comparable](tt TestingIface, expected, actual V, msgAndArgs ...any) bool
- func EqualAny(tt TestingIface, expected, actual any, msgAndArgs ...any) bool
- func EqualAnyf(tt TestingIface, expected any, actual 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 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, expected, actual 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 TestingIface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
func Equal[V comparable](tt TestingIface, expected, actual 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 KeyValErrorMsg ¶
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, expected, actual 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 TestingIface ¶
TestingIface is an interface wrapper for *testing.T, *testing.B, *testing.F
Click to show internal directories.
Click to hide internal directories.