mirror of
https://github.com/romdo/gomockctx.git
synced 2026-02-18 23:56:40 +00:00
27 lines
431 B
Go
27 lines
431 B
Go
package gomockctx
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.uber.org/mock/gomock"
|
|
)
|
|
|
|
// Any returns a gomock.Matcher which matches any context.Context object.
|
|
func Any() gomock.Matcher {
|
|
return &anyMatcher{}
|
|
}
|
|
|
|
type anyMatcher struct{}
|
|
|
|
var _ gomock.Matcher = &anyMatcher{}
|
|
|
|
func (cm *anyMatcher) Matches(x interface{}) bool {
|
|
_, ok := x.(context.Context)
|
|
|
|
return ok
|
|
}
|
|
|
|
func (cm *anyMatcher) String() string {
|
|
return "is a context.Context"
|
|
}
|