assert

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(t *testing.T, container any, key any, msg ...any)

Contains asserts that the given container contains the specified key. It supports string (substring check) and map types.

func Empty

func Empty(t *testing.T, v any, msg ...any)

Empty asserts that the given value is empty, nil, or has zero length. It fails the test if the value is not empty. Optionally, you can provide a custom message.

func Equal

func Equal(t *testing.T, expected, got any, msg ...any)

Equal compares two comparable values and fails if they differ.

func EqualError

func EqualError(t *testing.T, expected, err error, msg ...any)

EqualError asserts that err is not nil and its Error() matches expected.

func Error

func Error(t *testing.T, err error, msg ...any)

Error asserts that err is not nil.

func False

func False(t *testing.T, value bool, msg ...any)

False asserts that the given boolean value is false.

func Nil

func Nil(t *testing.T, v any, msg ...any)

Nil asserts that value is nil.

func NoError

func NoError(t *testing.T, err error, msg ...any)

NoError asserts that err is nil.

func NotEqual

func NotEqual(t *testing.T, expected, got any, msg ...any)

NotEqual asserts that two values are not equal.

func NotNil

func NotNil(t *testing.T, v any, msg ...any)

NotNil asserts that value is not nil.

func True

func True(t *testing.T, value bool, msg ...any)

True asserts that the given boolean value is true.

func WithinDuration

func WithinDuration(t *testing.T, expected, actual time.Time, delta time.Duration, msg ...any)

WithinDuration asserts that the two specified times are within a given duration of each other.

Types

This section is empty.

Jump to

Keyboard shortcuts

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