Documentation ¶
Overview ¶
Package be provides a set of built-in assertions for use with ghost.
Index ¶
- func All(results ...ghost.Result) ghost.Result
- func Any(results ...ghost.Result) ghost.Result
- func Close[T constraints.Integer | constraints.Float](got, want, delta T) ghost.Result
- func DeepEqual[T any](got, want T) ghost.Result
- func Equal[T comparable](got T, want T) ghost.Result
- func Error(err error) ghost.Result
- func ErrorAs(err error, target any) ghost.Result
- func ErrorContaining(err error, msg string) ghost.Result
- func ErrorEqual(err error, msg string) ghost.Result
- func ErrorIs(err error, target error) ghost.Result
- func Eventually(f func() ghost.Result, timeout time.Duration, interval time.Duration) ghost.Result
- func False(b bool) ghost.Result
- func Greater[T constraints.Ordered](a, b T) ghost.Result
- func GreaterOrEqual[T constraints.Ordered](a, b T) ghost.Result
- func JSONEqual[T ~string | ~[]byte](got, want T) ghost.Result
- func Less[T constraints.Ordered](a, b T) ghost.Result
- func LessOrEqual[T constraints.Ordered](a, b T) ghost.Result
- func MapLen[K comparable, V any](got map[K]V, want int) ghost.Result
- func Nil(v any) ghost.Result
- func Not(result ghost.Result) ghost.Result
- func Panic(f func()) (result ghost.Result)
- func SliceContaining[T comparable](slice []T, element T) ghost.Result
- func SliceLen[T any](got []T, want int) ghost.Result
- func StringContaining(str, substr string) ghost.Result
- func True(b bool) ghost.Result
- func Zero[T comparable](v T) ghost.Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Close ¶
func Close[T constraints.Integer | constraints.Float](got, want, delta T) ghost.Result
Close asserts that a value is within a delta of another.
func Equal ¶
func Equal[T comparable](got T, want T) ghost.Result
Equal asserts that two elements are equal.
func ErrorContaining ¶
ErrorContaining asserts that an error string contains a particular substring.
func ErrorEqual ¶
ErrorEqual asserts that an error string equals a particular message.
func Eventually ¶
func Eventually( f func() ghost.Result, timeout time.Duration, interval time.Duration, ) ghost.Result
Eventually asserts that a function eventually returns an Ok ghost.Result.
func Greater ¶
func Greater[T constraints.Ordered](a, b T) ghost.Result
Greater asserts that the first value provided is strictly greater than the second.
func GreaterOrEqual ¶
func GreaterOrEqual[T constraints.Ordered](a, b T) ghost.Result
GreaterOrEqual asserts that the first value provided is greater than or equal to the second.
func Less ¶
func Less[T constraints.Ordered](a, b T) ghost.Result
Less asserts that the first value provided is strictly less than the second.
func LessOrEqual ¶
func LessOrEqual[T constraints.Ordered](a, b T) ghost.Result
LessOrEqual asserts that the first value provided is less than or equal to the second.
func MapLen ¶
func MapLen[K comparable, V any](got map[K]V, want int) ghost.Result
MapLen asserts that the length of a map is a particular size.
func SliceContaining ¶
func SliceContaining[T comparable](slice []T, element T) ghost.Result
SliceContaining asserts that an element exists in a given slice.
func StringContaining ¶
StringContaining asserts that a substring exists in a given string.
func Zero ¶
func Zero[T comparable](v T) ghost.Result
Zero asserts that the given value equals its zero value.
Types ¶
This section is empty.