Documentation
¶
Overview ¶
Package expect provides simple test assertions.
Index ¶
- func ContainsMapKey[M ~map[K]V, K comparable, V any](t T, m M, key K)
- func ContainsSlice[S ~[]E, E comparable](t T, values S, item E)
- func ContainsString(t T, s, substr string)
- func Empty(t T, value any)
- func Equal[V comparable](t T, expected, actual V)
- func EqualMap[M ~map[K]V, K, V comparable](t T, expected, actual M)
- func EqualSlice[S ~[]E, E comparable](t T, expected, actual S)
- func Error(t T, err error)
- func ErrorAs(t T, err error, target any)
- func ErrorIs(t T, err, target error)
- func False(t T, value bool)
- func Greater[V cmp.Ordered](t T, a, b V)
- func GreaterOrEqual[V cmp.Ordered](t T, a, b V)
- func Len(t T, value any, expected int)
- func Less[V cmp.Ordered](t T, a, b V)
- func LessOrEqual[V cmp.Ordered](t T, a, b V)
- func Nil(t T, value any)
- func NoError(t T, err error)
- func NotContainsSlice[S ~[]E, E comparable](t T, values S, item E)
- func NotContainsString(t T, s, substr string)
- func NotEmpty(t T, value any)
- func NotEqual[V comparable](t T, unexpected, actual V)
- func NotEqualMap[M ~map[K]V, K, V comparable](t T, unexpected, actual M)
- func NotEqualSlice[S ~[]E, E comparable](t T, unexpected, actual S)
- func NotErrorIs(t T, err, target error)
- func NotNil(t T, value any)
- func True(t T, value bool)
- type T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsMapKey ¶ added in v0.3.0
func ContainsMapKey[M ~map[K]V, K comparable, V any](t T, m M, key K)
ContainsMapKey asserts that m contains key.
func ContainsSlice ¶ added in v0.3.0
func ContainsSlice[S ~[]E, E comparable](t T, values S, item E)
ContainsSlice asserts that values contains item.
func ContainsString ¶ added in v0.3.0
ContainsString asserts that s contains substr.
func Equal ¶
func Equal[V comparable](t T, expected, actual V)
Equal asserts that expected and actual are equal.
func EqualMap ¶
func EqualMap[M ~map[K]V, K, V comparable](t T, expected, actual M)
EqualMap asserts that expected and actual maps are equal.
func EqualSlice ¶
func EqualSlice[S ~[]E, E comparable](t T, expected, actual S)
EqualSlice asserts that expected and actual slices are equal.
func GreaterOrEqual ¶ added in v0.2.0
GreaterOrEqual asserts that a >= b.
func LessOrEqual ¶ added in v0.2.0
LessOrEqual asserts that a <= b.
func NotContainsSlice ¶ added in v0.3.0
func NotContainsSlice[S ~[]E, E comparable](t T, values S, item E)
NotContainsSlice asserts that values does not contain item.
func NotContainsString ¶ added in v0.3.0
NotContainsString asserts that s does not contain substr.
func NotEqual ¶
func NotEqual[V comparable](t T, unexpected, actual V)
NotEqual asserts that unexpected and actual are not equal.
func NotEqualMap ¶
func NotEqualMap[M ~map[K]V, K, V comparable](t T, unexpected, actual M)
NotEqualMap asserts that unexpected and actual maps are not equal.
func NotEqualSlice ¶
func NotEqualSlice[S ~[]E, E comparable](t T, unexpected, actual S)
NotEqualSlice asserts that unexpected and actual slices are not equal.
func NotErrorIs ¶ added in v0.3.0
NotErrorIs asserts that err does not match target using errors.Is.