Documentation
¶
Index ¶
- func Assert(t interface{ ... }, condition bool, msgAndArgs ...any) bool
- func Contains(t interface{ ... }, item any, collection any, msgAndArgs ...any) bool
- func ContainsAnyOf(t interface{ ... }, expected any, collection any, msgAndArgs ...any) bool
- func ContainsInAnyOrder[T any](t interface{ ... }, expected, actual []T, msgAndArgs ...any) bool
- func ContainsOnly[T any](t interface{ ... }, expected, actual []T, msgAndArgs ...any) bool
- func ContainsOnlyInAnyOrder[T any](t interface{ ... }, expected, actual []T, msgAndArgs ...any) bool
- func Equal[T any](t interface{ ... }, expected, actual T, msgAndArgs ...any) bool
- func Error(t interface{ ... }, err error, msgAndArgs ...any) bool
- func False(t interface{ ... }, condition bool, msgAndArgs ...any) bool
- func Nil(t interface{ ... }, value any, msgAndArgs ...any) bool
- func NoError(t interface{ ... }, err error, msgAndArgs ...any) bool
- func NotEmpty(t interface{ ... }, collection any, msgAndArgs ...any) bool
- func NotEqual[T any](t interface{ ... }, expected, actual T, msgAndArgs ...any) bool
- func NotNil(t interface{ ... }, value any, msgAndArgs ...any) bool
- func True(t interface{ ... }, condition bool, msgAndArgs ...any) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
func Assert(t interface {
Errorf(format string, args ...any)
Helper()
}, condition bool, msgAndArgs ...any) bool
Assert verifies that the condition is true. If not, it formats an error message and reports it through the test interface.
func Contains ¶
func Contains(t interface {
Errorf(format string, args ...any)
Helper()
}, item any, collection any, msgAndArgs ...any) bool
Contains checks if an item is present in a collection, or if a collection contains another collection
func ContainsAnyOf ¶
func ContainsAnyOf(t interface {
Errorf(format string, args ...any)
Helper()
}, expected any, collection any, msgAndArgs ...any) bool
ContainsAnyOf checks if the collection contains any elements from expected. For slice expected vs single value collection: checks if any element from the slice equals the single value. For string expected vs slice of strings collection: checks if each character in expected exists in any element of collection. For slice of strings expected vs string collection: checks if any string from the slice is contained in the collection string.
func ContainsInAnyOrder ¶
func ContainsInAnyOrder[T any](t interface { Errorf(format string, args ...any) Helper() }, expected, actual []T, msgAndArgs ...any) bool
ContainsInAnyOrder checks if the actual slice contains all elements from the expected slice in any order. Extra elements in the actual slice are allowed.
func ContainsOnly ¶
func ContainsOnly[T any](t interface { Errorf(format string, args ...any) Helper() }, expected, actual []T, msgAndArgs ...any) bool
ContainsOnly compares two slices and returns true if they contain exactly the same elements in the same order. If not, it formats an error message and reports it through the test interface.
func ContainsOnlyInAnyOrder ¶
func ContainsOnlyInAnyOrder[T any](t interface { Errorf(format string, args ...any) Helper() }, expected, actual []T, msgAndArgs ...any) bool
ContainsOnlyInAnyOrder compares two slices and returns true if they contain exactly the same elements in any order. If not, it formats an error message and reports it through the test interface.
func Equal ¶
func Equal[T any](t interface { Errorf(format string, args ...any) Helper() }, expected, actual T, msgAndArgs ...any) bool
Equal compares two values of the same type and returns true if they're equal. If they're not equal, it formats an error message and reports it through the test interface.
func Error ¶
func Error(t interface {
Errorf(format string, args ...any)
Helper()
}, err error, msgAndArgs ...any) bool
Error checks if the error is not nil and returns true if it is not.
func False ¶
func False(t interface {
Errorf(format string, args ...any)
Helper()
}, condition bool, msgAndArgs ...any) bool
False checks if the condition is false and returns true if it is.
func Nil ¶
func Nil(t interface {
Errorf(format string, args ...any)
Helper()
}, value any, msgAndArgs ...any) bool
Nil checks if the value is nil and returns true if it is. If the value is not nil, it formats an error message and reports it through the test interface.
func NoError ¶
func NoError(t interface {
Errorf(format string, args ...any)
Helper()
}, err error, msgAndArgs ...any) bool
NoError checks if the error is nil and returns true if it is. If the error is not nil, it formats an error message and reports it through the test interface.
func NotEmpty ¶
func NotEmpty(t interface {
Errorf(format string, args ...any)
Helper()
}, collection any, msgAndArgs ...any) bool
NotEmpty verifies that the collection (slice, map, string, etc.) is not empty. If it is empty, it formats an error message and reports it through the test interface.
func NotEqual ¶
func NotEqual[T any](t interface { Errorf(format string, args ...any) Helper() }, expected, actual T, msgAndArgs ...any) bool
NotEqual compares two values of the same type and returns true if they're not equal. If they're equal, it formats an error message and reports it through the test interface.
Types ¶
This section is empty.