Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBoolean = errors.New("CmpHook(got, expected) failed")
Functions ¶
This section is empty.
Types ¶
type Info ¶
Info gathers all hooks information.
func (*Info) AddCmpHooks ¶
AddCmpHooks records new Cmp hooks using functions contained in "fns".
Each function in "fns" has to be a function with the following possible signatures:
func (A, A) bool func (A, A) error
First arg is always "got", and second is always "expected".
A cannot be an interface. This retriction can be removed in the future, if really needed.
It returns an error if an item of "fns" is not a function or if its signature does not match the expected ones.
func (*Info) AddSmuggleHooks ¶
AddSmuggleHooks records new Smuggle hooks using functions contained in "fns".
Each function in "fns" has to be a function with the following possible signatures:
func (A) B func (A) (B, error)
A cannot be an interface. This retriction can be removed in the future, if really needed.
B can be an interface.
It returns an error if an item of "fns" is not a function or if its signature does not match the expected ones.
func (*Info) Cmp ¶
Cmp checks if a Cmp hook exists matching "got" and "expected" types.
If no, it returns (false, nil)
If yes, it calls it and returns (true, nil) if it succeeds, (true, <an error>) if it fails. If the hook returns a false bool, the error returned is ErrBoolean.