eproxus / meck

A mocking library for Erlang
http://eproxus.github.io/meck
Apache License 2.0
813 stars 231 forks source link

passthrough not working #132

Closed mitchellwrosen closed 9 years ago

mitchellwrosen commented 9 years ago

I expect this isn't a bug and I'm doing something wrong on my end, but this is the behavior I'm seeing:

foo.erl

-module(foo).
-export([bar/0]).
bar() -> bar.

Baby steps...

1> meck:new(foo).
ok
2> meck:expect(foo, bar, fun() -> mocked end).
ok
3> foo:bar().
mocked

Passthrough attempt 1...

1> meck:new(foo, [passthrough]).
ok
2> foo:bar().
** exception error: undefined function foo_meck_original:bar/0
     in function  foo:bar/0
        called as foo:bar()

And passthrough attempt 2...

1> meck:new(foo).
ok
2> meck:expect(foo, bar, fun() -> meck:passthrough([]) end).
ok
3> foo:bar().
** exception error: undefined function foo_meck_original:bar/0
     in function  foo:bar/0
        called as foo:bar()
eproxus commented 9 years ago

Yeah, this is a bit nasty. foo needs to be compiled with debug_info, e.g. c(foo, [debug_info]) for pass through to work. See #14.

eproxus commented 9 years ago

Closing because of inactivity.