Provision of switching Devel::Cover on/off

落爺英雄遲暮 提交于 2019-12-12 21:08:51

问题


While using Devel::Cover in a test code which tests CodeA, does Devel::Cover have an option of switching the coverage off. Is there a way to switch the coverage module on or off as per user?

Test code tests CodeA. Devel::Cover commands are embedded in Test code whenever CodeA commands get tested.

Does Devel::Cover include any provision where this coverage collection can be switched on or off?


回答1:


There is a way to turn coverage on and off at runtime, but it seems that I have forgotten to document it. However, it is tested, so you can see how to use it there:

https://github.com/pjcj/Devel--Cover/blob/master/t/internal/criteria.t

This isn't exactly the same as if Devel::Cover had never been loaded, but rather it just stops Devel::Cover collecting coverage information for the criteria which are turned off.



来源:https://stackoverflow.com/questions/24420346/provision-of-switching-develcover-on-off

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!