You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, sorry I didn't cook up a pull request the usual way. This is a really small change, but it's tremendously useful. When a module is defined in passthrough mode, when doing the following:
meck:new(foo, [passthrough]),
meck:expect(foo, bar, fun(X) case random:uniform(100) of
N when N < 50 ->
%% somehow call the original foo:bar/1 function but with
%% the same X or perhaps a modified X.
_ ->
%% Do something completely novel, like we usually
%% do with Meck.
end).
Using this new function, we could put the following into the first case clause:
Thanks for considering. I'm happily using this new function for nefarious testing purposes. The rest of Meck is quite useful, thanks for all of your work.
The text was updated successfully, but these errors were encountered:
Thanks! The passthrough/1 function that already exists already allows you to call the original function. However, it had one limitation that it exited the expect-function when it was called. This is now changed in c336ce1 (based on the solution in your patch) where you can also use the return value inside the expect-function:
meck:expect(m, f, fun(N) -> M = meck:passthrough([N+1]), M / 2 end).
(This also closes the old #2 issue on the same topic).
Hi, sorry I didn't cook up a pull request the usual way. This is a really small change, but it's tremendously useful. When a module is defined in passthrough mode, when doing the following:
Using this new function, we could put the following into the first case clause:
or perhaps:
The small patch is:
Thanks for considering. I'm happily using this new function for nefarious testing purposes. The rest of Meck is quite useful, thanks for all of your work.
The text was updated successfully, but these errors were encountered: