Documentation
¶
Index ¶
- func Annotate(inner assertion.Assertion, msg string, args ...any) assertion.Annotated
- func Ascending[V cmp.Ordered](list []V) assertion.Assertion
- func DeepEqual[V any](expected V, got V) assertion.Assertion
- func Descending[V cmp.Ordered](list []V) assertion.Assertion
- func Empty[V any](list []V) assertion.Assertion
- func Equal[V comparable](expected V, got V) assertion.Assertion
- func ErrorIs(v error, target error) assertion.Assertion
- func Eventually(fn func(ctx context.Context) error, tick time.Duration, attempts uint) assertion.Assertion
- func Failed() assertion.Assertion
- func False(v bool) assertion.Assertion
- func Implemented[T any](v any) assertion.Assertion
- func InDelta[V constraints.Number](a, b, delta V) assertion.Assertion
- func InList[V comparable](list []V, item V) assertion.Assertion
- func InMap[K comparable, V any](m map[K]V, key K) assertion.Assertion
- func Len[V any](list []V, expectedLen int) assertion.Assertion
- func Nil(v any) assertion.Assertion
- func NilPtr[V any](v *V) assertion.Assertion
- func NoError(v error) assertion.Assertion
- func NoPanic(fn func()) assertion.Assertion
- func NonEmpty[V any](list []V) assertion.Assertion
- func NonNil(v any) assertion.Assertion
- func NonNilPtr[V any](v *V) assertion.Assertion
- func Not(v assertion.Assertion) assertion.Assertion
- func NotDeepEqual[V any](unexpected V, got V) assertion.Assertion
- func NotEqual[V comparable](unexpected V, got V) assertion.Assertion
- func OfType[T any](v any) assertion.Assertion
- func Panic(fn func()) assertion.Assertion
- func Passed() assertion.Assertion
- func Prefix(v string, prefix string) assertion.Assertion
- func Same[V any](expected *V, got *V) assertion.Assertion
- func Substring(v string, sub string) assertion.Assertion
- func Suffix(v string, suffix string) assertion.Assertion
- func True(v bool) assertion.Assertion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ascending ¶
Ascending asserts that the given list is sorted in ascending order (each item is less or equal to the next item).
func Descending ¶
Descending asserts that the given list is sorted in descending order (each item is greater or equal to the next item).
func Equal ¶
func Equal[V comparable](expected V, got V) assertion.Assertion
Equal runs a shallow-equal assertion
func Eventually ¶
func Eventually(fn func(ctx context.Context) error, tick time.Duration, attempts uint) assertion.Assertion
Eventually runs a function repeatedly until it succeeds or the context is done.
func Implemented ¶
Implemented asserts that the given value implements the given interface.
func InDelta ¶
func InDelta[V constraints.Number](a, b, delta V) assertion.Assertion
InDelta asserts that the given values are within the given delta. The delta must be positive. If the delta is zero, the values must be equal.
func InList ¶
func InList[V comparable](list []V, item V) assertion.Assertion
InList asserts that the given item is contained in the list.
func InMap ¶
func InMap[K comparable, V any](m map[K]V, key K) assertion.Assertion
InMap asserts that the given key is present in the map.
func Nil ¶
Nil asserts that the given value is nil, including interface values that contain nil pointers.
func NonNil ¶
NonNil asserts that the given value is not nil, including interface values that contain nil pointers.
func Not ¶
Not asserts that the given assertion fails. For better readability and error reporting, use the assertion-specific inverse assertions instead.
func NotDeepEqual ¶
NotDeepEqual runs a deep-not-equal assertion
func NotEqual ¶
func NotEqual[V comparable](unexpected V, got V) assertion.Assertion
NotEqual runs a shallow-not-equal assertion
func OfType ¶
OfType asserts that the given value is of the given type. The reflect type of T is compared to the reflect type of the given value.
Types ¶
This section is empty.