Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


fix bad match error when cover data file not exists. #60

wants to merge 2 commits into from

2 participants


It's quite minor fix.
Sometimes a test with meck would fail when cover data file didn't generate by any reason.


Hmm, this will still fail with a case-clause error. Can you give me anymore hints on how to reproduce the error?


I apologize for late reply.
This error may occur the same mocked module in two or more tests.
It's somewhat rare case, actually.


This justs adds a print statement when it fails, I think a normal badmatch will suffice for detecting this case. Together with line numbers in exceptions in R15 it should be easy to track down.

I'd appreciate a patch to fix the original problem, so please open another pull request if you have a clue of how to fix it. Alternatively open an issue with instructions of how to reproduce the error.

@eproxus eproxus closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 6, 2012
Commits on Apr 20, 2012
  1. fix case clause failure

    Minsu Choi authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/meck.erl
8 src/meck.erl
@@ -676,8 +676,12 @@ restore_original(Mod, {File, Data, Options}, WasSticky) ->
restick_original(Mod, WasSticky),
- ok = cover:import(Data),
- ok = file:delete(Data),
+ case cover:import(Data) of
+ ok ->
+ ok = file:delete(Data);
+ {error, Reason} ->
+ io:format("Cover import failure : ~p~n", [Reason])
+ end,
unstick_original(Module) -> unstick_original(Module, code:is_sticky(Module)).
Something went wrong with that request. Please try again.