Documentation
¶
Overview ¶
Package assert provides assertion helpers for testing, offering both functional and fluent assertion styles. When an assertion fails, the test will continue running. For assertions that should stop the test on failure, use the `require` package.
Index ¶
- func Error(t internal.TestingT, v error) *internal.ErrorAssertion
- func Map[K, V comparable](t internal.TestingT, v map[K]V) *internal.MapAssertion[K, V]
- func Number[T internal.Number](t internal.TestingT, v T) *internal.NumberAssertion[T]
- func Panic(t internal.TestingT, fn func(), expr string, msg ...string)
- func Slice[T comparable](t internal.TestingT, v []T) *internal.SliceAssertion[T]
- func String(t internal.TestingT, v string) *internal.StringAssertion
- func That(t internal.TestingT, v any) *internal.Assertion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶ added in v1.2.4
func Error(t internal.TestingT, v error) *internal.ErrorAssertion
Error returns a new ErrorAssertion for the given error value.
func Map ¶ added in v1.2.4
func Map[K, V comparable](t internal.TestingT, v map[K]V) *internal.MapAssertion[K, V]
Map returns a MapAssertion for the given testing object and map value.
func Panic ¶
Panic asserts that `fn` panics and the panic message matches `expr`. It reports an error if `fn` does not panic or if the recovered message does not satisfy `expr`.
func Slice ¶ added in v1.2.4
func Slice[T comparable](t internal.TestingT, v []T) *internal.SliceAssertion[T]
Slice returns a SliceAssertion for the given testing object and slice value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.