Provision of switching Devel::Cover on/off
Asked Answered
F

1

3

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?

Flatten answered 25/6, 2014 at 23:42 Comment(0)
A
4

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.

Agronomy answered 26/6, 2014 at 11:24 Comment(1)
Thanks for your help. I am still confused as to the running part and making it stop after looking at your testcase.Do I have to call set_ coverage with none parameter followed by get_coverage everytime before a perl -MDevel::Cover command to remove coverage? Or does the remove_coverage option work?Flatten

© 2022 - 2024 — McMap. All rights reserved.