Documentation ¶
Overview ¶
Package errors provides useful assert functions for handling errors on tests
Index ¶
- func Assert(t *testing.T, err, target error, args ...interface{})
- func AssertAsErrorsList(t *testing.T, err error)
- func AssertErrorList(t *testing.T, err error, targets []error)
- func AssertIsErrors(t *testing.T, err error, targets []error)
- func AssertIsKind(t *testing.T, err error, k errors.Kind)
- func AssertKind(t *testing.T, got, want error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertAsErrorsList ¶
AssertAsErrorsList will check if the given error can be handled as an *errors.List by calling errors.As. It fails if the error fails to be an *errors.List.
func AssertErrorList ¶
AssertErrorList will check that the given err is an *errors.List and that all given errors on targets are contained on it using errors.Is.
func AssertIsErrors ¶
AssertIsErrors will check that all target errors are contained within the given err. Usually err underlying implementation is an errors.List, but that is not enforced, it is enough that for all the target errors errors.Is returns true, so this function also works for long chains of errors.
func AssertIsKind ¶
AssertIsKind asserts err is of kind k.
func AssertKind ¶
AssertKind asserts that got is of same error kind as want.
Types ¶
This section is empty.