Skip to content
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

Mocked module will return empty function clause error #167

Closed
edgurgel opened this issue Nov 22, 2016 · 1 comment
Closed

Mocked module will return empty function clause error #167

edgurgel opened this issue Nov 22, 2016 · 1 comment
Labels

Comments

@edgurgel
Copy link
Contributor

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
Copy link
Owner

eproxus commented Feb 13, 2017

Turns out the fix was relatively simple 😄 Sorry for the long delay!

@eproxus eproxus added the bug label Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants