Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmpEq ¶
Example ¶
package main
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/higebu/matchers"
"github.com/higebu/matchers/example"
)
func main() {
t := &testing.T{} // provided by test
ctrl := gomock.NewController(t)
m := example.NewMockFoo(ctrl)
m.EXPECT().Bar(matchers.CmpEq([]*example.A{{Name: "blah"}})).Return(nil)
m.Bar([]example.A{{Name: "blah"}})
}
Output:
func ProtoMsgEq ¶
Example ¶
package main
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/higebu/matchers"
"github.com/higebu/matchers/example"
"github.com/higebu/matchers/testpb"
)
func main() {
t := &testing.T{} // provided by test
ctrl := gomock.NewController(t)
m := example.NewMockFoo(ctrl)
m.EXPECT().Bar(matchers.ProtoMsgEq(&testpb.Message{Name: "blah"})).Return(nil)
m.Baz(&testpb.Message{Name: "blah"})
}
Output:
func TimestampEq ¶
func TimestampEq(x *timestamppb.Timestamp) gomock.Matcher
Example ¶
package main
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/golang/protobuf/ptypes"
"github.com/higebu/matchers"
"github.com/higebu/matchers/example"
)
func main() {
t := &testing.T{} // provided by test
ctrl := gomock.NewController(t)
m := example.NewMockFoo(ctrl)
now := ptypes.TimestampNow()
m.EXPECT().Qux(matchers.TimestampEq(now)).Return(nil)
m.Qux(now)
}
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.