[erlang-questions] meck

Roberto Ostinelli <>
Mon Jul 23 04:15:42 CEST 2012


dear all,

i'm trying to use the meck framework (https://github.com/eproxus/meck) and
i can't seem to find a way to test that a function gets called with the
appropriate values.

for instance:

%%%%%%%%%%%%%%%%%%%%

-module(example).
-compile(export_all).

get_config() ->
mocked:myfun("test.config").

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").

get_config_test_() ->
meck:new(mocked),
meck:expect(mocked, myfun, fun(Filename) -> ok end),
?_assertEqual(ok, get_config()),
?_assert(meck:validate(mocked)).
-endif.

%%%%%%%%%%%%%%%%%%%%

i'd like to test that mocked:myfun/1 gets called with "test.config" as
parameter.

is this possible?

r.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120722/7d068b2f/attachment.html>


More information about the erlang-questions mailing list