Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make erlymock play nice with cover #8

Open
nialscorva opened this issue Jan 30, 2011 · 0 comments
Open

Make erlymock play nice with cover #8

nialscorva opened this issue Jan 30, 2011 · 0 comments

Comments

@nialscorva
Copy link
Owner

Erlymock will erase code coverage statistics for a module when it is mocked. This potentially under reports coverage when a test suite is run.

Example

x_tests:test().

Module x has 100% coverage.

y_tests:test() -> 
erlymock:stub(x,foo,[]), 
%...

Module x now has 0% coverage. Reverse the order of x_tests and y_tests, and module x will have 100% coverage.

Problem

In erlymock.erl, load_module runs code:delete and code:purge on the mocked module before inserting the mocked version. This removes the code coverage information. In erlymock:terminate, the mocked code is then deleted and purged, then cover:compiled. This keeps cover from spewing angry messages about code that's not cover compiled, and has no effect if cover is not being used.

Potential fixes

Roughly in order of desirability:

  • Can we save a reference to the module and put it back during terminate, rather than delete/purge?
  • Is there a way to preserve cover information for the module and reinsert it?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant