Documentation
¶
Index ¶
- func Contains(t TestingT, whole any, sub any, args ...any) bool
- func Equal(t TestingT, expected any, actual any, args ...any) bool
- func Error(t TestingT, err error, args ...any) bool
- func ErrorContains(t TestingT, err error, substr string, args ...any) booldeprecated
- func FailIf(t TestingT, condition bool, args ...any) bool
- func FailIfError(t TestingT, err error, args ...any) bool
- func False(t TestingT, condition bool, args ...any) bool
- func FatalIf(t TestingT, condition bool, args ...any)
- func FatalIfError(t TestingT, err error, args ...any)
- func Len(t TestingT, obj any, length int, args ...any) bool
- func MapLen[K comparable, V any](t TestingT, m map[K]V, length int, args ...any) booldeprecated
- func Nil(t TestingT, obj any, args ...any) bool
- func NoError(t TestingT, err error, args ...any) bool
- func NotContains(t TestingT, whole any, sub any, args ...any) bool
- func NotEqual(t TestingT, expected any, actual any, args ...any) bool
- func NotNil(t TestingT, obj any, args ...any) bool
- func NotZero(t TestingT, actual any, args ...any) bool
- func SliceContains[T comparable](t TestingT, slice []T, contains T, args ...any) booldeprecated
- func SliceEqual[T comparable](t TestingT, expected []T, actual []T, args ...any) booldeprecated
- func SliceLen[T any](t TestingT, slice []T, length int, args ...any) booldeprecated
- func SliceNotContains[T comparable](t TestingT, slice []T, contains T, args ...any) booldeprecated
- func SliceNotEqual[T comparable](t TestingT, expected []T, actual []T, args ...any) booldeprecated
- func StrLen(t TestingT, s string, length int, args ...any) booldeprecated
- func True(t TestingT, condition bool, args ...any) bool
- func Zero(t TestingT, actual any, args ...any) bool
- type Asserter
- func (a *Asserter) Contains(whole any, sub any, args ...any) bool
- func (a *Asserter) Equal(expected any, actual any, args ...any) bool
- func (a *Asserter) Error(err error, args ...any) bool
- func (a *Asserter) False(condition bool, args ...any) bool
- func (a *Asserter) Len(obj any, length int, args ...any) bool
- func (a *Asserter) Nil(obj any, args ...any) bool
- func (a *Asserter) NoError(err error, args ...any) bool
- func (a *Asserter) NotContains(whole any, sub any, args ...any) bool
- func (a *Asserter) NotEqual(expected any, actual any, args ...any) bool
- func (a *Asserter) NotNil(obj any, args ...any) bool
- func (a *Asserter) NotZero(actual any, args ...any) bool
- func (a *Asserter) True(condition bool, args ...any) bool
- func (a *Asserter) Zero(actual any, args ...any) bool
- type TestingT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
Contains fails the test if a string or error don't contain a substring, or if a byte slice doesn't contain a byte subslice, or if a slice doesn't contain an element, or if a map doesn't contain a key.
func FailIf ¶
FailIf fails the test if the condition is met. If returns back the result of evaluating the condition.
func FailIfError ¶
FailIfError is a shortcut to FailIf(t, err != nil, append([]any{err}, args...)...) .
func FatalIfError ¶
FatalIfError is a shortcut to FatalIf(t, err != nil, append([]any{err}, args...)...) .
func Len ¶ added in v0.3.3
Len fails the test if the length of the string, slice, array, map or chan does not match the expected len.
func NotContains ¶
NotContains fails the test if a string or error contain a substring, or if a byte slice contains a byte subslice, or if a slice contains an element, or if a map contains a key.
func NotZero ¶
NotZero fails the test if the value is the 0 value of its type. Nils are considered zero.
func SliceContains
deprecated
func SliceContains[T comparable](t TestingT, slice []T, contains T, args ...any) bool
SliceContains fails the test if the slice does not contain the item.
Deprecated: Use Contains
func SliceEqual
deprecated
func SliceEqual[T comparable](t TestingT, expected []T, actual []T, args ...any) bool
SliceEqual fails the test if the two values are not equal.
Deprecated: Use Equal
func SliceNotContains
deprecated
func SliceNotContains[T comparable](t TestingT, slice []T, contains T, args ...any) bool
SliceNotContains fails the test if the slice contains the item.
Deprecated: Use NotContains
func SliceNotEqual
deprecated
func SliceNotEqual[T comparable](t TestingT, expected []T, actual []T, args ...any) bool
SliceNotEqual fails the test if the two values are equal.
Deprecated: Use NotEqual
Types ¶
type Asserter ¶ added in v0.4.0
type Asserter struct {
// contains filtered or unexported fields
}
func (*Asserter) Contains ¶ added in v0.4.0
Contains fails the test if the string does not contain a substring.
func (*Asserter) Len ¶ added in v0.4.0
Len fails the test if the length of the string, slice, array, map or chan does not match the expected len.
func (*Asserter) NotContains ¶ added in v0.4.0
NotContains fails the test if the string contain a substring.
func (*Asserter) NotZero ¶ added in v0.4.0
NotZero fails the test if the value is the 0 value of its type.
