Documentation
¶
Index ¶
- func Equal[Type any](t common.T, want Type, got Type, opts ...gocmp.Option)
- func Error(t common.T, err error)
- func False(t common.T, x bool)
- func GreaterThan[Type cmp.Ordered](t common.T, big Type, small Type)
- func GreaterThanOrEqual[Type cmp.Ordered](t common.T, big Type, small Type)
- func In[Type any](t common.T, want Type, slice []Type, opts ...gocmp.Option)
- func LessThan[Type cmp.Ordered](t common.T, small Type, big Type)
- func LessThanOrEqual[Type cmp.Ordered](t common.T, small Type, big Type)
- func Nil(t common.T, val any)
- func NoError(t common.T, err error)
- func NoErrors(t common.T, thunks ...(func() error))
- func NoFailures(t common.T, thunks ...(func()))
- func NotEqual[Type any](t common.T, want Type, got Type, opts ...gocmp.Option)
- func NotIn[Type any](t common.T, want Type, slice []Type, opts ...gocmp.Option)
- func NotNil(t common.T, val any)
- func True(t common.T, x bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
Equal passes if want == got.
Otherwise, the test is immediately failed and stopped with t.FailNow().
This is a typesafe check for equality using go-cmp, allowing arguments only of the same type to be compared.
You can change the behavior of the equality checking using the go-cmp/cmp Options system. For more information, see [the go-cmp documentation](https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal).
func Error ¶
Error passes if err != nil.
Otherwise, the test is immediately failed and stopped with t.FailNow().
func False ¶
False passes if x == false.
Otherwise, the test is immediately failed and stopped with t.FailNow().
func GreaterThan ¶
GreaterThan passes if big > small.
Otherwise, the test is immediately failed and stopped with t.FailNow().
func GreaterThanOrEqual ¶
GreaterThanOrEqual passes if big >= small.
Otherwise, the test is immediately failed and stopped with t.FailNow().
func In ¶
In passes if want is an element of slice.
Otherwise, the test is immediately failed and stopped with t.FailNow().
You can change the behavior of the equality checking using the go-cmp/cmp Options system. For more information, see [the go-cmp documentation](https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal).
func LessThan ¶
LessThan passes if small < big.
Otherwise, the test is immediately failed and stopped with t.FailNow().
func LessThanOrEqual ¶
LessThanOrEqual passes if small <= big.
Otherwise, the test is immediately failed and stopped with t.FailNow().
func Nil ¶
Nil passes if val == nil.
Otherwise, the test is immediately failed and stopped with t.FailNow().
Uses reflection because Go doesn't have a type constraint for "nilable". Can return false for the following types:
- error
- pointer
- interface
- map
- slice
- channel
- function
- unsafe.Pointer
func NoError ¶ added in v0.0.4
NoError passes if err == nil
Otherwise, the test is immediately failed and stopped with t.FailNow().
func NoErrors ¶
NoErrors will exit the test immediately if any checks have previously failed. Then, if supplied, thunks will be called. If the code in the thunk resulted in a non-fatal test error, the test is immediately failed. If the thunk returns an error value, the test is immediately failed.
func NoFailures ¶
NoFailures will exit the test immediately if any checks have previously failed. Then, if supplied, thunks will be called. If the code in the thunk resulted in a non-fatal test error, the test is immediately failed.
func NotEqual ¶
NotEqual passes if want != got.
Otherwise, the test is immediately failed and stopped with t.FailNow().
This is a typesafe check for inequality using go-cmp, allowing arguments only of the same type to be compared.
You can change the behavior of the inequality checking using the go-cmp/cmp Options system. For more information, see [the go-cmp documentation](https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal).
func NotIn ¶
NotIn passes if want is not an element of slice.
Otherwise, the test is immediately failed and stopped with t.FailNow().
You can change the behavior of the inequality checking using the go-cmp/cmp Options system. For more information, see [the go-cmp documentation](https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal).
func NotNil ¶ added in v0.0.6
NotNil passes if val != nil.
Otherwise, the test is immediately failed and stopped with t.FailNow().
Uses reflection because Go doesn't have a type constraint for "nilable". Can return false for the following types:
- error
- pointer
- interface
- map
- slice
- channel
- function
- unsafe.Pointer
Types ¶
This section is empty.