golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.26k stars 608 forks source link

Check arguments of callback function #657

Open rekby opened 2 years ago

rekby commented 2 years ago

Requested feature Check type of arguments and return type for callback function in Do/DoAndReturn while add callback, similar to check types of return values in Return function.

Why the feature is needed Now Do/DoAndReturn functions check count arguments only, but real type checked at call moment. It will be better cause error on mock initialization instead of mock call - because I see line where initialization failed.

(Optional) Proposed solution Check callback arguments in Do and DoAndReturn about it same as original func arg type of assignable from them.