问题描述
在测试CodeA的测试代码中使用Devel :: Cover时,Devel :: Cover是否可以选择关闭覆盖范围.有没有一种方法可以按用户打开或关闭Coverage模块?
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?
测试代码测试CodeA.每当对CodeA命令进行测试时,Devel :: Cover命令就会嵌入到测试代码中.
Test code tests CodeA.Devel::Cover commands are embedded in Test code whenever CodeA commands get tested.
Devel :: Cover是否包括可以打开或关闭此coverage集合的任何规定?
Does Devel::Cover include any provision where this coverage collection can be switched on or off?
推荐答案
有一种方法可以在运行时打开和关闭覆盖范围,但是似乎我忘记了对其进行记录.但是,它已经过测试,因此您可以在那里查看如何使用它:
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 /开发-封面/blob/master/t/internal/criteria.t
这与从未加载过Devel :: Cover并不完全相同,但是它只是停止了Devel :: Cover收集针对已关闭条件的覆盖率信息.
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.
这篇关于提供开关Devel :: Cover on/off的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!