Mocked module will return empty function clause error
Closed this issue · 1 comments
edgurgel commented
A mocked module will not throw the cause that failed to match.
Reproduction Steps
make shell
ok = meck:new(mymod, [non_strict]).
ok = meck:expect(mymod, test, [1], 2).
catch(mymod:test(2)).
{'EXIT',
{function_clause,
[{io_lib_pretty,cind_tag_tuple,7,
[{file,"io_lib_pretty.erl"},{line,637}]},
{io_lib_pretty,cind_element,7,
[{file,"io_lib_pretty.erl"},{line,726}]},
{io_lib_pretty,cind_list,7,
[{file,"io_lib_pretty.erl"},{line,696}]},
{io_lib_pretty,cind_element,7,
[{file,"io_lib_pretty.erl"},{line,726}]},
{io_lib_pretty,cind_list,7,
[{file,"io_lib_pretty.erl"},{line,696}]},
{io_lib_pretty,cind_element,7,
[{file,"io_lib_pretty.erl"},{line,726}]},
{io_lib_pretty,cind_list,7,
[{file,"io_lib_pretty.erl"},{line,696}]},
{io_lib_pretty,while_fail,3,
[{file,"io_lib_pretty.erl"},{line,737}]}]}}
Expected behavior
I was expecting to get the function and arguments that didn't match. If the expectation is using an anonymous function, this error shows up:
11> catch(mymod:test(2)).
{'EXIT',
{function_clause,
[{erl_eval,'-inside-an-interpreted-fun-',[2],[]},
{erl_eval,expr,3,[]}]}}
So at least the arguments are shown [2]
Observed behavior
It shows an empty function clause error giving no visibility of what failed to match.
Versions
Meck version: master
Erlang version: OTP 18
eproxus commented
Turns out the fix was relatively simple 😄 Sorry for the long delay!