Documentation
¶
Index ¶
- func Approximately(t *testing.T, expected time.Duration, actual time.Duration, ...)
- func ElementsMatch[T any](t *testing.T, arrA, arrB []T, prefixes ...string)
- func Equal(t *testing.T, expected interface{}, actual interface{}, prefixes ...string)
- func Error(t *testing.T, err error, prefixes ...string)
- func ErrorIs(t *testing.T, err error, target error, prefixes ...string)
- func ErrorType(t *testing.T, err error, target error, prefixes ...string)
- func ErrorWith(t *testing.T, err error, content string, prefixes ...string)
- func MapHas[K comparable, V any](t *testing.T, m map[K]V, key K, val V, prefixes ...string)
- func MapMatch[K comparable, V any](t *testing.T, mapA, mapB map[K]V, prefixes ...string)
- func NilError(t *testing.T, err error, prefixes ...string)
- func NotEqual(t *testing.T, expected interface{}, actual interface{}, prefixes ...string)
- func NotNil(t *testing.T, val interface{}, prefixes ...string)
- type Counter
- type ErrorFunc
- type ResultErrorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Approximately ¶ added in v0.3.0
func Approximately(t *testing.T, expected time.Duration, actual time.Duration, delta time.Duration, prefixes ...string)
Approximately asserts actual duration is approximately(within delta difference) equal to expected duration.
func ElementsMatch ¶
ElementsMatch asserts both slices have the same amount and equal elements. Any extra items will be listed in error log.
func ErrorWith ¶
ErrorWith asserts err does contain target content within error string representation.
func MapHas ¶
func MapHas[K comparable, V any](t *testing.T, m map[K]V, key K, val V, prefixes ...string)
MapHas asserts that map contains specified key with equal value.
func MapMatch ¶
func MapMatch[K comparable, V any](t *testing.T, mapA, mapB map[K]V, prefixes ...string)
MapMatch asserts all keys and corresponding values are applied to both map.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func Count ¶
Count returns a Counter with expected n count to be asserted. Use Inc() to mark a call. Assert() will be called on test cleanup, so it's not necessary to call it manually but recommended due to convention to not hide any test side effects.