You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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
Module x has 100% coverage.
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:
The text was updated successfully, but these errors were encountered: