Documentation ¶
Index ¶
- Variables
- func DeepClone[T any](v T) T
- func NewFactory[T any](defaultState T) func(...func(*T)) T
- func NoErr[V any](value V, err error) V
- func NotPanics(t *testing.T, f func())
- func Setup[D any](s func(t *Hook[D])) setup[D]
- func SetupWithTestCase[Dependencies, TestCase any](s func(t *CHook[Dependencies, TestCase])) withDepAndCase[Dependencies, TestCase]
- type CHook
- type DCTest
- type DTest
- type Hook
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoMatchType = errors.New("no match type") ErrNoPointer = errors.New("must be interface") ErrInvalidArgument = errors.New("invalid arguments") )
View Source
var BetterStack = true
BetterStack is set as true by default. It trims the stack for removing internals and the package module from the stack.
Functions ¶
func DeepClone ¶ added in v0.2.0
func DeepClone[T any](v T) T
DeepClone is a function to deep clone a value. It can clone public and private values, but not private strings, as they are immutable.
func NewFactory ¶ added in v0.2.0
func NewFactory[T any](defaultState T) func(...func(*T)) T
NewFactory is a function to create a state factory. It allows you to create a valid initial state and modify it with functions. It is useful for creating test cases that verify field-by-field validation. It's also useful for centralizing the creation of a single valid struct, as validation rule changes, you only need to change it in one place.
func SetupWithTestCase ¶ added in v0.2.0
Types ¶
type CHook ¶ added in v0.2.0
type CHook[D, C any] struct { *require.Assertions *testing.T Dependencies *D Case *C After func() }
type DCTest ¶ added in v0.2.0
type DCTest[D, C any] struct { *require.Assertions T *testing.T Dependencies *D Case *C }
Click to show internal directories.
Click to hide internal directories.