assert

package
v0.0.0-...-c1fbc2c Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(t Testing, value any, check any, options ...Option)

Contains checks if an interface contains the contents of another. If the value is a string, it checks for a substring.

func Equals

func Equals(t Testing, actual any, expected any, options ...Option)

Equals checks if the expected and actual values are equal.

func Error

func Error(t Testing, err error, options ...Option)

Error checks if an error occurred.

func ErrorExact

func ErrorExact(t Testing, err error, msg string, options ...Option)

ErrorExact checks if an error occurred with an exact message.

func ErrorPart

func ErrorPart(t Testing, err error, part string, options ...Option)

ErrorPart checks if an error occurred with a message containing a part.

func False

func False(t Testing, value bool, options ...Option)

False checks if a value is false.

func FloatEquals

func FloatEquals[T ~float64 | ~float32](t Testing, first T, second T, epsilon T, options ...Option)

func Nil

func Nil(t Testing, value any, options ...Option)

Nil checks if a value is nil.

func NoError

func NoError(t Testing, err error, options ...Option)

NoError checks if no error occurred.

func NotEquals

func NotEquals(t Testing, actual any, expected any, options ...Option)

NotEquals checks if the expected and actual values are not equal.

func NotNil

func NotNil(t Testing, value any, options ...Option)

NotNil checks if a value is not nil.

func Panic

func Panic(t Testing, panicFunc func(), options ...Option)

Panic checks if a function panics.

func PanicExact

func PanicExact(t Testing, panicFunc func(), msg string, options ...Option)

PanicExact checks if a function panics with an exact message.

func PanicPart

func PanicPart(t Testing, panicFunc func(), part string, options ...Option)

PanicPart checks if a function panics with a message containing a part.

func True

func True(t Testing, value bool, options ...Option)

True checks if a value is true.

Types

type Option

type Option func(t *testContext)

Option modifies the configuration of testing.

func Continue

func Continue() Option

Continue marks the test as having failed but continues execution.

type Testing

type Testing interface {
	Name() string
	Helper()
	Error(...any)
	Fatal(...any)
}

Testing matches the functions on the testing.T struct.

Jump to

Keyboard shortcuts

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