-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support type-safe InOrder and After #77
Conversation
Currently when type-safe return values are used, one can't use `InOrder` neither `After` with them as they expect `*gomock.Call` as parameters. This changes the type these functions expect to be an interface which implements the `GetCall() *Call` method, which returns the embedded `*gomock.Call` type for generated mock types. Using this approach helps to have compile-time error/warnings instead of runtime errors with a reflection based solution. Fixes (#70)
0d99752
to
9b18c60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this PR out in quic-go/quic-go#4057 and it seems to work (CI failures are due to #80 and #81, which are unrelated to this PR).
Add a new exported interface `CallWrapper` which allow users to use `InOrder` and `After` with generated type-safe mock types.
Let's go with the approach #78 instead. The addition of this @marten-seemann could you try with #78 instead? |
Currently when type-safe return values are used, one can't use
InOrder
neitherAfter
with them as they expect*gomock.Call
as parameters. This changes the type these functionsexpect to be an interface which implements the
GetCall() *Call
method,which returns the embedded
*gomock.Call
type for generated mock types.Using this approach helps to have compile-time error/warnings instead of
runtime errors with a reflection based solution.
Fixes (#70)