Skip to content
eproxus edited this page Dec 3, 2014 · 3 revisions

Library module name 'foo' does not match calling module 'foo_meck_original'?

See #59. Are you mocking a NIF? This error message comes from erlang:load_nif/2. A simple workaround is to rewrite

foo() ->
    some_nif:some_func().

as

foo() -> 
    ?MODULE:some_nif_some_func().

some_nif_some_func() ->
    some_nif:some_func().

Note the ?MODULE: above.


I've mocked a helper function, yet when another function calls it, it's not mocked!!

See #120. The Erlang compiler generates a local function jump when compiling local functions. You must export the function and use a fully qualified function call, i.e. prefix it with the module name. For example, if you wish to mock bar, Rewrite

foo() -> 
    bar().

as

-export([bar/0]).

foo() -> 
    ?MODULE:bar().

Passthrough is not working.

See #14. Your module must be compiled with debug_info. Either add +debug_info as a flag to erlc or include the atom debug_info when calling the Erlang compiler. Rebar automatically adds debug_info when your application is compiled for testing.