On Fri, May 21, 2004 at 12:50:55PM -0400, Geoffrey Young wrote:
> 
> >> I might like to signal Devel::Cover that func() has a constant return (or
> >> lack thereof).
> > 
> > I don't know if I would like this feature. To me it would allow you to
> > falsely skew the results of the Devel::Cover output. I look at
> > Devel::Cover as a harshly objective analysis of my test-code coverage,
> > anything destroying that objectivity IMO would lessen the value of the
> > tool.
> 
> however, in the process of development we are required to analyze any of the
> inevitable gaps and decide whether the unhit condition is valid.  if it is
> we write  a test for it.  if it represents a condition we would explain away
> (D::C limitation, or whatnot) then it would be nice to have some way to
> track it within the tool itself.  partially to appease management with heavy
> greens, but more to save development cycles chasing down issues I (or other
> developers) have analyzed before.

I enjoyed this discussion and the various opinions and suggestions.

It has always been my plan to include something along these lines.  The
TODO list (which seems to keep growing) mentions "Marking of unreachable
code - commandline tool and gui."  I think this is useful for exactly
the reasons Geoff gave.  Hacking the figures to appease management seems
to me to be quite a long way down a slippery slope, but (unfortunately)
I can understand the motivation.

For me, <100% coverage has never necessarily indicated an error, which
is why, internally, each item of coverage has associated with it the
number of times it was covered, the total number of times that it could
have been covered, the percentage that represents and, crucially,
whether or not that indicates an error.

I have just released Devel::Cover 0.45 and I've included some code which
is working towards a solution in this area.  The code seems to work, but
there is no (reasonable) user interface for it, and it is not documented
at all.  You'll need to grep the source for "uncoverable" if you want to
play with it.  With this, the textual report can report no errors even
when the coverage is not 100%.

Of course, this was not obvious the Michael when he wrote the html
output backend, and so the colours there are dictated by the percentage,
but if you use my original (and ugly) html_basic backend you can see how
you can get green everywhere without 100% coverage.  The halfway house
of html_subtle is, fittingly, halfway between in this regard too ;-)

Michael has some ideas for backends and interfaces to the uncoverable
code, which I'll let him talk about or work on as he sees fit.

Actually, I've just noticed that the test I shipped is broken, which
illustrates the fragility of the interface.  Or the testing framework.
Or the code.  Or something.

Other features of this release:

 - Cope with spaces in build path on Windows (Max Maischein).
 - Allow Devel::Cover to be used under mod_perl (Philippe M. Chiasson).
 - Handle $x ||= 1 and friends nicely, including subs and *foo{THING}.

Enjoy,

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to