mock icon indicating copy to clipboard operation
mock copied to clipboard

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

Open sirzooro opened this issue 2 years ago • 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.

sirzooro avatar Sep 01 '23 08:09 sirzooro

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().

r-hang avatar Sep 06 '23 21:09 r-hang