-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Num_calls increments when called function returns #165
Comments
Thanks for the report, I'll look into changing this. |
Initially a bit trickier, because the count is based on the history, and the history is only recorded when the call has finished (including the result of the call). To migrate to some structure where calls are recorded separately from results is a bigger change. 😞 |
My schedule is a little crazy at the moment but I'm happy to help out where I can. |
So, currently the history looks like this: [
...
call --> .
.
.
return <-- {Pid, {Mod, Func, Args}, Result},
...
call --> .
.
.
.
.
return <-- {Pid, {Mod, Func, Args}, Result},
...
] Options:
|
Sorry for the extended absence. I've been thinking about solution number 2. Would you want that form to become the result of I'm interested to see how it would work out but if it's a complete nonstarter then something more option 3 is fine for my case. |
Ideally we would go for option 2. A first step could be an internal refactoring, with an implementation that allows for We could also just work on master, upgrading the history format and API, and let people who want stability stay on 0.8. |
It appears that the value returned by
meck:num_calls(...)
only updates after the called function has returned. This makes verifying behaviour around long running functions difficult.Reproduction Steps
Here's a passing eunit test to recreate the scenario I have.
Expected behavior
I would expect that
meck:num_calls
would update as soon as the function is entered and the runtime of that function to have no effect. I would exepect the first call to?assertEqual(0, meck:num_calls(dummy, test, [ long ])),
to fail with a value 1 being returned insteadVersions
Meck version: 0.8.4
Erlang version: 18.2.1
The text was updated successfully, but these errors were encountered: