uber-go/mock

Allow using functions without arguments in Do() and DoAndReturn()

sirzooro opened this issue · 1 comments

Please allow using functions without arguments in Do() and DoAndReturn(). Many times that function does not need to do anything with arguments, so this would simplify test creation a bit.

r-hang commented

Adding this comment to clarify the issue after taking a look:

Today, Do() and DoReturn() expect the function provided to it to match the signature of the underlying Call object method. If the underlying Call method being mocked does not have parameters, Do and DoAndReturn work as expected.

The user ask is to drop the restriction in the case of anonymous functions with no parameter when the underlying Call method has parameters for the convenience of not needing to specify parameters when calling Do() or DoAndReturn().