assert

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package assert contains small assertion test functions to assist in writing clean tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(tb testing.TB, collection, item interface{}) bool

Contains asserts item is contained by collection

func Equal

func Equal(tb testing.TB, expected, actual interface{}) bool

Equal asserts actual is equal to expected

func Error

func Error(tb testing.TB, err error) bool

Error asserts err is not nil

func ErrorIs added in v0.3.2

func ErrorIs(tb testing.TB, err, target error) bool

ErrorIs asserts err matches target

func Eventually

func Eventually(tb testing.TB, fn func(context.Context) bool, totalWait time.Duration, checkInterval time.Duration) bool

Eventually asserts fn() returns true within totalWait time, checking at the given interval

func NoError

func NoError(tb testing.TB, err error) bool

NoError asserts err is nil

func NotContains

func NotContains(tb testing.TB, collection, item interface{}) bool

NotContains asserts item is not contained by collection

func NotEqual

func NotEqual(tb testing.TB, expected, actual interface{}) bool

NotEqual asserts actual is not equal to expected

func NotErrorIs added in v0.3.2

func NotErrorIs(tb testing.TB, err, target error) bool

NotErrorIs asserts err does match target

func NotPanics

func NotPanics(tb testing.TB, fn func()) bool

NotPanics asserts fn() does not panic

func NotZero

func NotZero(tb testing.TB, value interface{}) bool

NotZero asserts value is not the zero value

func Panics

func Panics(tb testing.TB, fn func()) (panicked bool)

Panics asserts fn() panics

func Zero

func Zero(tb testing.TB, value interface{}) bool

Zero asserts value is the zero value

Types

This section is empty.

Jump to

Keyboard shortcuts

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