Closed edgurgel closed 7 years ago
A mocked module will not throw the cause that failed to match.
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}]}]}}
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]
[2]
It shows an empty function clause error giving no visibility of what failed to match.
Meck version: master Erlang version: OTP 18
Turns out the fix was relatively simple 😄 Sorry for the long delay!
A mocked module will not throw the cause that failed to match.
Reproduction Steps
make shell
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:
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