assert

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package assert provides assertion helpers for testing, offering both functional and fluent assertion styles. When an assertion fails, the test will continue running. For assertions that should stop the test on failure, use the `require` package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error added in v1.2.4

Error returns a new ErrorAssertion for the given error value.

func Map added in v1.2.4

func Map[K, V comparable](t internal.TestingT, v map[K]V) *internal.MapAssertion[K, V]

Map returns a MapAssertion for the given testing object and map value.

func Number

Number returns a NumberAssertion for the given testing object and number value.

func Panic

func Panic(t internal.TestingT, fn func(), expr string, msg ...string)

Panic asserts that `fn` panics and the panic message matches `expr`. It reports an error if `fn` does not panic or if the recovered message does not satisfy `expr`.

func Slice added in v1.2.4

func Slice[T comparable](t internal.TestingT, v []T) *internal.SliceAssertion[T]

Slice returns a SliceAssertion for the given testing object and slice value.

func String added in v1.2.4

String returns a StringAssertion for the given testing object and string value.

func That

That creates an Assertion for the given value v and test context t.

Types

This section is empty.

Jump to

Keyboard shortcuts

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