Documentation ¶
Overview ¶
Package erkmock allows creating erk errors to be returned from mocked interfaces. Without using this package, it's possible to get false positive strict mode errors.
Example:
someMockedFunction.Returns(erkmock.From(store.ErrItemNotFound))
Index ¶
- func For(kind erk.Kind) error
- func From(err error) error
- type Mock
- func (m *Mock) Error() string
- func (m *Mock) Export() erk.ExportedErkable
- func (m *Mock) ExportRawMessage() string
- func (m *Mock) Is(err error) bool
- func (m *Mock) Kind() erk.Kind
- func (m *Mock) Params() erk.Params
- func (m *Mock) SetMessage(message string)
- func (m *Mock) WithParams(params erk.Params) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock erk.Erkable implementation. Setting parameters on a mock modify the mock in place. Thus, it is recommended to create a new mock instead of using the same one multiple times.
func (*Mock) ExportRawMessage ¶ added in v0.5.6
ExportRawMessage without executing the template.
func (*Mock) Is ¶
Is implements the Go 1.13+ Is interface for use with errors.Is.
If the mock has no message set, only the error kinds are compared. Otherwise, the error kinds and messages are compared.
func (*Mock) SetMessage ¶ added in v0.5.6
SetMessage on the mock.
Click to show internal directories.
Click to hide internal directories.