[erlang-questions] Mocking I/O calls - defining sequence of returns

Dmitry Demeshchuk demeshchuk@REDACTED
Mon May 23 11:51:10 CEST 2011


You can use meck and process dictionary combination, for example:

mock_sequence(Mod, Fun, L) ->
     put({Mod, Fun}, L),
     meck:expect(Mod, Fun, fun() ->
          [H | T] = get({Mod, Fun}),
          put({Mod, Fun}, T),
          H
     end).

On Sat, May 21, 2011 at 9:31 PM, Alyssa Kwan <alyssa.c.kwan@REDACTED> wrote:
> Hi everyone!
>
> Are there any mocking libraries written that allow you to expect a sequence of calls and return a different value for each call?  A mocking library that allows passthrough would be ideal.
>
> Thanks!
> Alyssa
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



-- 
Best regards,
Dmitry Demeshchuk



More information about the erlang-questions mailing list