Skip to content
This repository

meck:unload is undefined? #72

ostinelli opened this Issue July 22, 2012 · 3 comments

2 participants

Roberto Ostinelli Adam Lindberg
Roberto Ostinelli

Using this module, and R15B01:


get_config() ->


get_config_test_() ->
    meck:expect(mocked, myfun, fun(Filename) -> ok end),
    ?_assertEqual(ok, get_config()),

Compiling and running tests:

1> c(example, [{d, 'TEST'}]).
example.erl:19: Warning: variable 'Filename' is unused
example.erl:20: Warning: a term is constructed, but never used
example.erl:21: Warning: a term is constructed, but never used
12> example:test().           
*** test module not found ***

  Failed: 0.  Skipped: 0.  Passed: 0.
One or more tests were cancelled.

However, if I comment the line meck:unload(mocked). then test passes successfully.

Adam Lindberg

Sorry for the late reply. The issue occurs because the trailing underscore (get_config_test_) tells EUnit that the function is a test generator, not a test. EUnit then expects the function to return a list of tests instead.

Adam Lindberg eproxus closed this August 03, 2012
Roberto Ostinelli

indeed, it's a generator. i guess then meck has to be used within a test. i haven't find anything clarifying that in docs.

thank you,


Adam Lindberg

Meck is not tied to a specific test library or framework. It just has a functional API that you can use in any code, really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.