mock
mock copied to clipboard
Return last call for InOrder
The following changes InOrder to return the last called Call. This allows a more fluent design when using InOrder, things can be better chained together and allows composing of numerous InOrder calls.
Example:
func doX(ctrl *gomock.Controller) *gomock.Call {
mock := NewMockA(ctrl)
return gomock.InOrder(
doZ(mock),
mock.EXPECT().Foo().Return("bar"),
)
}
func doY(ctrl *gomock.Controller) *gomock.Call {
mock := NewMockB(ctrl)
return gomock.InOrder(
doZ(mock),
mock.EXPECT().Bar().Return("foo"),
)
}
gomock.InOrder(
doX(ctrl),
doY(ctrl),
)
Body here copied from #199
This seems like a reasonable change, but it is breaking so holding off for now.
it is breaking
Is it? Won't compile?
Because it is pure feat if it compiles.
UPD Some can make use of given func (...gomock.Call) signature indeed. Won't compile in this case. Pure feat though for a reasonable usage.