assert

package
v0.0.0-...-328f497 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepEqual

func DeepEqual[V any](t testing.TB, variable string, actual, expected V) bool

DeepEqual checks if the actual and expected value are equal as determined by reflect.DeepEqual(), and t.Error()s otherwise.

func Equal

func Equal[V comparable](t TestingT, actual, expected V) bool

Equal checks if the actual and expected value are equal according to == rules, and t.Errors() otherwise.

func ErrEqual

func ErrEqual(t TestingT, actual error, expectedErrorOrMessageOrRegexp any) bool

ErrEqual checks if the actual error matches the expectation.

  • If `expected` is nil, the actual error must be nil.
  • If `expected` is of type error, the actual error must be exactly equal to it, or contain it in the sense of errors.Is().
  • If `expected` is of type string, the actual error message must be exactly equal to it.
  • If `expected` is of type *regexp.Regexp, that regexp must match the actual error message.

Types

type TestingT

type TestingT interface {
	Helper()
	Errorf(msg string, args ...any)
}

TestingT is an interface implemented by the *testing.T type. Some tests inside go-bits use this interface to substitute a mock for the real *testing.T type.

Jump to

Keyboard shortcuts

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