Documentation
¶
Overview ¶
Package assert provides utility functions for testing which help assert provided conditions are met.
Index ¶
- func ElementsMatch[T comparable](t testing.TB, expected, actual []T) bool
- func Equal(t testing.TB, expected, actual any) bool
- func EqualError(t testing.TB, err error, expected string) bool
- func Error(t testing.TB, err error) bool
- func ErrorContains(t testing.TB, err error, contains string) bool
- func Fail(t testing.TB, msg string, a ...any) bool
- func False(t testing.TB, actual bool) bool
- func IsType[T any](t testing.TB, object any) bool
- func Len(t testing.TB, object any, length int) bool
- func NoError(t testing.TB, err error) bool
- func Panic(t testing.TB, f func(), expected string) (result bool)
- func Require(t testing.TB, isPassing bool)
- func True(t testing.TB, actual bool) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ElementsMatch ¶
func ElementsMatch[T comparable](t testing.TB, expected, actual []T) bool
ElementsMatch fails the test if the expected and actual slices do not have the same elements.
func EqualError ¶
EqualError fails the test if the expected error is not equal to the actual error message.
func ErrorContains ¶
ErrorContains fails the test if the expected error does not contain the provided string.
func IsType ¶
IsType fails the test if the object is not of the expected type. The expected type is specified using a type parameter.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.