assert

package
v0.2.1 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

Overview

Package assert contains common assertions on builtin types.

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{}, args ...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.1.3

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

ErrorIs asserts 'err' matches the expected 'target'. Uses errors.Is().

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 IsType

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

IsType asserts both value's types are equal

func NoError

func NoError(tb testing.TB, err error, args ...interface{}) 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{}, args ...interface{}) bool

NotEqual asserts actual is not equal to expected

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 Prefix

func Prefix(tb testing.TB, expected, actual string) bool

Prefix asserts actual starts with expected

func Subset

func Subset(tb testing.TB, sub, super interface{}) bool

Subset asserts 'sub' is a subset of 'super'

func Suffix added in v0.1.12

func Suffix(tb testing.TB, expected, actual string) bool

Suffix asserts actual ends with expected

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