Skip to content
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

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

Open
sirzooro opened this issue Sep 1, 2023 · 1 comment
Open

Comments

@sirzooro
Copy link

sirzooro commented Sep 1, 2023

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
Copy link
Contributor

r-hang commented Sep 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants