assert

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolIs

func BoolIs(t testing.TB, got, want bool)

BoolIs asserts the given bool value.

func Chan2NotWritten

func Chan2NotWritten[T any, U any](t testing.TB, c chan T, d chan U, timeout time.Duration)

Chan2NotWritten asserts that the chans are not written at least until the passed timeout value.

func ChanNotWritten

func ChanNotWritten[T any](t testing.TB, c chan T, timeout time.Duration)

ChanNotWritten asserts that the chan is not written at least until the passed timeout value.

func ChanWritten

func ChanWritten[T any](t testing.TB, c chan T) T

ChanWritten returns the value written to chan c or times out.

func ChanWrittenWithVal added in v0.1.4

func ChanWrittenWithVal[T any](t testing.TB, c chan T, want T) T

ChanWrittenWithVal asserts the chan c was written with a value that DeepEquals v.

func ChanWrittenWithValTimeout added in v0.2.0

func ChanWrittenWithValTimeout[T any](t testing.TB, c chan T, want T, timeout time.Duration) T

ChanWrittenWithValTimeout asserts the chan c was written with a value that DeepEquals v before the timeout expires.

func Contains added in v0.2.0

func Contains[S ~[]E, E comparable](t testing.TB, s S, e E)

Contains asserts that s contains e.

func ContextDone

func ContextDone(t testing.TB, ctx context.Context)

ContextDone asserts the passed context is done.

func DeepEqual

func DeepEqual[T any](t testing.TB, got, want T)

DeepEqual asserts got is reflect.DeepEqual to want.

func DoesNotBlock

func DoesNotBlock(t testing.TB, f func())

DoesNotBlock asserts that calling f() does not block for an inordinate amount of time.

func ErrorIs

func ErrorIs(t testing.TB, got, want error)

ErrorIs asserts that errors.Is(got, want).

func NilErr

func NilErr(t testing.TB, err error)

NilErr fails the test if err is non-nil.

func NilErrFromChan

func NilErrFromChan(t testing.TB, errChan chan error)

NilErrFromChan fails the test if a non-nil error is received in the chan or if the channel fails to be written to in 30 seconds.

func NonNilErr added in v0.1.6

func NonNilErr(t testing.TB, err error)

NonNilErr asserts that err is not nil. It's preferable to use a specific error check instead of this one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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