assert

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal[Type any](t common.T, want Type, got Type, opts ...cmp.Option)

Equal passes if want == got, otherwise immediately failing the test.

This is a typesafe check for inequality using go-cmp, allowing arguments only of the same type to be compared. Most of the time, this is the equality-checking method that you want.

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

func Error(t common.T, err error)

Error passes if err != nil, otherwise immediately failing the test.

func False

func False(t common.T, x bool)

False passes if x == false, otherwise immediately failing the test.

func GreaterThan

func GreaterThan[Type constraints.Ordered](t common.T, big Type, small Type)

GreaterThan passes if big > small, otherwise immediately failing the test.

func GreaterThanOrEqual

func GreaterThanOrEqual[Type constraints.Ordered](t common.T, big Type, small Type)

GreaterThanOrEqual passes if big >= small, otherwise immediately failing the test.

func In

func In[Type any](t common.T, want Type, slice []Type, opts ...cmp.Option)

In passes if want is an element of slice, otherwise immediately failing the test.

func LessThan

func LessThan[Type constraints.Ordered](t common.T, small Type, big Type)

LessThan passes if small < big, otherwise immediately failing the test.

func LessThanOrEqual

func LessThanOrEqual[Type constraints.Ordered](t common.T, small Type, big Type)

LessThanOrEqual passes if small <= big, otherwise immediately failing the test.

func Nil

func Nil(t common.T, err error)

Nil passes if err == nil, otherwise immediately failing the test.

func NoErrors

func NoErrors(t common.T, thunks ...(func() error))

func NoFailures

func NoFailures(t common.T, thunks ...(func()))

NoFailures will exit the test immediately if any checks have previously failed. This includes any calls to `t.Fail` or `t.Error`, not just those from Testy.

func NotEqual

func NotEqual[Type any](t common.T, want Type, got Type, opts ...cmp.Option)

NotEqual passes if want != got, otherwise immediately failing the test.

This is a typesafe check for inequality using go-cmp, allowing arguments only of the same type to be compared. Most of the time, this is the inequality-checking method that you want.

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 NotIn

func NotIn[Type any](t common.T, want Type, slice []Type, opts ...cmp.Option)

NotIn passes if want is an not element of slice, otherwise immediately failing the test.

func True

func True(t common.T, x bool)

True passes if x == true, otherwise immediately failing the test.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL