Documentation
¶
Overview ¶
Package matchers is a set of matchers used with Gomock. They're all implementing the gomock.Matcher interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AsyncBlockMatcher ¶ added in v1.3.0
type AsyncBlockMatcher struct {
// contains filtered or unexported fields
}
func AsyncBlock ¶ added in v1.1.0
func AsyncBlock(matcher gomock.Matcher) *AsyncBlockMatcher
AsyncBlock returns a matcher holding a channel which will be signaled when the `Matches` function is called. AsyncBlock will wrap any other matcher to do the actual matching.
This is useful if the code you're testing is spawning a go function which will invoke your mock at some time in the future. The channel gives you an easy way to wait for that invokation (using `<- matcher.Channel()`) and then do assertions.
func (*AsyncBlockMatcher) Channel ¶ added in v1.3.0
func (m *AsyncBlockMatcher) Channel() <-chan struct{}
Channel returns a channel which will have an empty struct written to it every time `Matches` is invoked.
func (*AsyncBlockMatcher) Matches ¶ added in v1.3.0
func (m *AsyncBlockMatcher) Matches(x interface{}) bool
func (*AsyncBlockMatcher) String ¶ added in v1.3.0
func (m *AsyncBlockMatcher) String() string
type ProtoMatcher ¶ added in v1.4.0
type ProtoMatcher struct {
// contains filtered or unexported fields
}
func (*ProtoMatcher) Matches ¶ added in v1.4.0
func (p *ProtoMatcher) Matches(x interface{}) bool
func (*ProtoMatcher) String ¶ added in v1.4.0
func (p *ProtoMatcher) String() string
type RecordMatcher ¶ added in v1.3.0
type RecordMatcher struct {
// contains filtered or unexported fields
}
func Record ¶
func Record(m gomock.Matcher) *RecordMatcher
Record returns a new matcher which wraps the provided matcher - following all the matching rules of that matcher. In addition, the argument which is matched is recorded and can later be retrieved for inspection using the Get() func
func (*RecordMatcher) Get ¶ added in v1.3.0
func (rm *RecordMatcher) Get() interface{}
func (*RecordMatcher) Matches ¶ added in v1.3.0
func (rm *RecordMatcher) Matches(x interface{}) bool
func (*RecordMatcher) String ¶ added in v1.3.0
func (rm *RecordMatcher) String() string
type RegexpMatcher ¶ added in v1.3.0
type RegexpMatcher struct {
// contains filtered or unexported fields
}
func Regexp ¶ added in v1.2.0
func Regexp(pattern string) *RegexpMatcher
func (*RegexpMatcher) Matches ¶ added in v1.3.0
func (m *RegexpMatcher) Matches(x interface{}) bool
func (*RegexpMatcher) String ¶ added in v1.3.0
func (m *RegexpMatcher) String() string
type SameMatcher ¶ added in v1.3.0
type SameMatcher struct {
// contains filtered or unexported fields
}
func Same ¶
func Same(x interface{}) *SameMatcher
Same will return a new Same matcher which uses `==` comparison
func (*SameMatcher) Matches ¶ added in v1.3.0
func (m *SameMatcher) Matches(x interface{}) bool
func (*SameMatcher) String ¶ added in v1.3.0
func (m *SameMatcher) String() string