Documentation ¶
Overview ¶
Package qaone ...
Index ¶
- func Assert(stb SubTB, assert Assertion, format string, a ...any) bool
- type Assertion
- func About[T constraints.Integer | constraints.Float](va, vb, delta T) Assertion
- func AnyError(v any) Assertion
- func ChannelClosed[T any](ch <-chan T, timeout time.Duration) Assertion
- func ChannelReceives[T comparable](ch <-chan T, expected T, timeout time.Duration) Assertion
- func Contains[S ~[]T, T comparable](vs S, content T) Assertion
- func ContainsNot[S ~[]T, T comparable](vs S, content T) Assertion
- func DeepContains(vs []any, content any) Assertion
- func DeepEqual(va, vb any) Assertion
- func Different[T comparable](va, vb T) Assertion
- func Empty(v any) Assertion
- func Equal[T comparable](va, vb T) Assertion
- func ErrorContains(v any, contains string) Assertion
- func ErrorMatches(v any, pattern string) Assertion
- func Fail(info any) Assertion
- func False(v any) Assertion
- func GroupWaits(wg *sync.WaitGroup, timeout time.Duration) Assertion
- func Length(v any, l int) Assertion
- func Matches(v, re string) Assertion
- func Nil(v any) Assertion
- func NoError(v any) Assertion
- func NotEmpty(v any) Assertion
- func NotNil(v any) Assertion
- func NotOK(v any) Assertion
- func OK(v any) Assertion
- func OneCase(v string) Assertion
- func Panics(pf func()) Assertion
- func PanicsNot(pf func()) Assertion
- func PanicsWith(pf func(), v any) Assertion
- func PathExists(v string) Assertion
- func Range[T constraints.Integer | constraints.Float](v, min, max T) Assertion
- func Retries(f func() (bool, error), timeout time.Duration) Assertion
- func True(v any) Assertion
- func Zero(v any) Assertion
- type SubTB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Assertion ¶
Assertion describes a function performing an assertion and returning false if it failed. Additionally it returns a message describing the assertion failure.
func About ¶
func About[T constraints.Integer | constraints.Float](va, vb, delta T) Assertion
About asserts that two numbers are about equal within a delta.
func AnyError ¶
AnyError asserts that a value is an error, a function returning an error or a type implementing an Err() error method and the error is not nil.
func ChannelClosed ¶
ChannelClosed asserts that a channel is closed within a timeout.
func ChannelReceives ¶
func ChannelReceives[T comparable](ch <-chan T, expected T, timeout time.Duration) Assertion
ChannelReceives asserts that a channel receives a wanted value within a timeout.
func Contains ¶
func Contains[S ~[]T, T comparable](vs S, content T) Assertion
Contains asserts that a slice contains a specific value.
func ContainsNot ¶
func ContainsNot[S ~[]T, T comparable](vs S, content T) Assertion
ContainsNot asserts that a slice does not contain a specific value.
func DeepContains ¶
DeepContains asserts that a slice of any value contains a specific value.
func Different ¶
func Different[T comparable](va, vb T) Assertion
Different asserts that two comparable values are different.
func Equal ¶
func Equal[T comparable](va, vb T) Assertion
Equal asserts that two comparable values are equal.
func ErrorContains ¶
ErrorContains asserts that a value is an error like in AnyError and the error contains the given string.
func ErrorMatches ¶
ErrorMatches asserts that a value is an error like in AnyError and the error matches the given regular expression.
func GroupWaits ¶
GroupWaits asserts that a wait group is done within a timeout.
func NotOK ¶
NotOK asserts that a value is false, not nil, not 0, not "", an error or a function returning false or a non-nil error.
func OK ¶
OK asserts that a value is true, nil, 0, "", no error or a function returning true or a nil error.
func PanicsNot ¶
func PanicsNot(pf func()) Assertion
PanicsNot asserts that a function does not panic.
func PanicsWith ¶
PanicsWith asserts that a function panics with a given value.
func Range ¶
func Range[T constraints.Integer | constraints.Float](v, min, max T) Assertion
Range asserts that a number is in a range.