Documentation ¶
Overview ¶
package assert contains logic to assert test values.
Index ¶
- func Equals[T comparable](t *testing.T, expected T, actual T) (ok bool)
- func EqualsFunc[T comparable](t testing.TB, expected T, actual T, equals func(expected T, actual T) bool) (ok bool)
- func ErrorIs(t testing.TB, expected error, actual error) bool
- func Is[T any](t *testing.T, value any) T
- func Nil(t *testing.T, value any) bool
- func NoError(t *testing.T, err error) bool
- func NotEquals[T comparable](t *testing.T, expected T, actual T) (ok bool)
- func NotNil(t *testing.T, value any) bool
- type Want
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equals ¶
func Equals[T comparable](t *testing.T, expected T, actual T) (ok bool)
Equals compares expected to actual and returns true if they are equal. If the expected type is a protobuf message, proto.Equals will be used for comparison. Otherwise, the test fails (but continues) and false is returned.
func EqualsFunc ¶ added in v0.0.6
func EqualsFunc[T comparable](t testing.TB, expected T, actual T, equals func(expected T, actual T) bool) (ok bool)
Equals compares expected to actual using the equals function and returns true if they are equal. If the expected type is a protobuf message, proto.Equals will be used for comparison. Otherwise, the test fails (but continues) and false is returned.
func Is ¶
Is asserts that value is of type T. If it succeeds, it returns the value casted to T. If it fails, we fatally fail the test, because we cannot continue.
func NotEquals ¶ added in v0.0.5
func NotEquals[T comparable](t *testing.T, expected T, actual T) (ok bool)
NotEquals compares expected to actual and returns true if they are not equal. If the expected type is a protobuf message, proto.Equals will be used for comparison. Otherwise, the test fails (but continues) and false is returned.