Documentation ¶
Index ¶
- func Cmp(t *testing.T, expected any, opts ...cmp.Option) gomock.Matcher
- func DoMatch[V any](m func(v V) bool) gomock.Matcher
- func ErrorEq(expectedError string) gomock.Matcher
- func ErrorIs(expectedError error) gomock.Matcher
- func GRPCOutgoingCtx(kv map[string]string) gomock.Matcher
- func ProtoEq(t *testing.T, msg any, opts ...cmp.Option) gomock.Matcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoMatch ¶
DoMatch creates lambda matcher instance equipped with lambda function to detect if actual value matches some arbitrary criteria. Lambda matcher implements gomock customer matcher interface https://github.com/uber/mock/blob/5b455625bd2c8ffbcc0de6a0873f864ba3820904/gomock/matchers.go#L25. Sample of usage:
mock.EXPECT().Foo(gomock.All(
DoMatch(func(v Bar) bool { v.Greeting == "Hello world" }),
))
func GRPCOutgoingCtx ¶
GRPCOutgoingCtx returns a matcher for context.Context that must contain gRPC outgoing metadata with certain key-value pairs.
func ProtoEq ¶
ProtoEq is a better gomock.Eq() that works correctly for protobuf messages. Use this matcher when checking equality of structs that: - are v1 protobuf messages (i.e. implement "github.com/golang/protobuf/proto".Message). - are v2 protobuf messages (i.e. implement "google.golang.org/protobuf/proto".Message). - have fields of the above types. See https://blog.golang.org/protobuf-apiv2 for v1 vs v2 details.
Types ¶
This section is empty.