This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 607
Hard to debug when a Do(fn) function no longer matches its mock signature #71
Labels
Comments
This seems reasonable. We are open to PRs 😸 |
cvgw
added a commit
that referenced
this issue
Feb 2, 2020
Update the error handling for Call.Do in the case where the argument passed to Call.Do does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 2, 2020
Update the error handling for Call.Do in the case where the argument passed to Call.Do does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 2, 2020
Update the error handling for Call.Do in the case where the argument passed to Call.Do does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 2, 2020
Update the error handling for Call.Do in the case where the argument passed to Call.Do does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 2, 2020
Update the error handling for Call.Do in the case where the argument passed to Call.Do does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 2, 2020
Update the error handling for Call.Do in the case where the argument passed to Call.Do does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 2, 2020
Update the error handling for Call.Do in the case where the argument passed to Call.Do does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 6, 2020
Update the error handling for Call.Do and Call.DoAndReturn in the case where the argument passed does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call Call.DoAndReturn has additional validations on the return signature * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 6, 2020
Update the error handling for Call.Do and Call.DoAndReturn in the case where the argument passed does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call Call.DoAndReturn has additional validations on the return signature * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 28, 2020
Update the error handling for Call.Do and Call.DoAndReturn in the case where the argument passed does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call Call.DoAndReturn has additional validations on the return signature * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 28, 2020
Update the error handling for Call.Do and Call.DoAndReturn in the case where the argument passed does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call Call.DoAndReturn has additional validations on the return signature * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 28, 2020
Update the error handling for Call.Do and Call.DoAndReturn in the case where the argument passed does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call Call.DoAndReturn has additional validations on the return signature * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
cvgw
added a commit
that referenced
this issue
Feb 28, 2020
Update the error handling for Call.Do and Call.DoAndReturn in the case where the argument passed does not match expectations. * panic if the argument is not a function * panic if the number of input arguments do not match those expected by Call * panic if the types of the input arguments do not match those expected by Call Call.DoAndReturn has additional validations on the return signature * panic if the number of return arguments do not match those expected by Call * panic if the types of return arguments do not match those expected by Call
Reopening since the fix was reverted |
codyoss
added a commit
that referenced
this issue
May 14, 2021
Previous behavior was a panic would happen if the number of args did not match. Now the test should fail more gracefully and allow for better debugging. Fixes: #71
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Situation: we had code like:
and tests like:
Then we added an argument to
Bar
:and updated the
EXPECT()
:... but forgot to update
do
. The result was "panic: reflect: Call with too many input arguments" with no strong indication that what was wrong was thedo
function, rather than some place where the third argument hadn't been added (e.g. missingwantArg3
).It would be nice if the message said something more obvious like "EXPECT.()Do() function doesn't match the mock signature".
The text was updated successfully, but these errors were encountered: