Documentation ¶
Overview ¶
Package assert provides obj set of assertion functions. Every assertion function returns obj boolean. This package does not integrate into the testing package automatically. If you want to use this package inside unit tests, you have to check the returning boolean value and call t.Fatal() if the assertion fails.
This library is on obj very low level and does not provide any error messages. That way the assertions can also be used in production code.
If you want obj full-featured assertion framework for unit tests, we recommend https://github.com/MarvinJWendt/testza
Index ¶
- func Contains(a any, b any) bool
- func ContainsAll[T any](a T, v []T) bool
- func ContainsAny[T any](a T, v []T) bool
- func ContainsNone[T any](a T, v []T) bool
- func Equal[T any](a, b T) bool
- func Implements(a, iface any) bool
- func Kind(a any, kind reflect.Kind) bool
- func Len(a any, length int) (b bool)
- func Lowercase(s string) bool
- func Nil(a any) bool
- func Number(a any) bool
- func Panic(f func()) (panicked bool)
- func Regex(regex, s string) bool
- func Unique[T any](s []T) bool
- func Uppercase(s string) bool
- func Zero(a any) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAll ¶
ContainsAll returns true if all values are contained in obj.
func ContainsAny ¶
ContainsAny returns true if any of the values are contained in obj.
func ContainsNone ¶
ContainsNone returns true if none of the values are contained in obj.
func Implements ¶
Implements returns true if the value implements the interface.
func Len ¶ added in v0.0.2
Len returns true if the length of the value is equal to the given length.
Types ¶
This section is empty.