Documentation
¶
Overview ¶
Package require provides assertion helpers that stop test execution on failure. For assertions that should allow the test to continue on failure, use the `assert` 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 Number ¶ added in v1.2.4
Number returns a NumberAssertion for the given testing object and number 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.