Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Devel-Cover CPAN distribution.

Report information
The Basics
Id: 63698
Status: resolved
Priority: 0/
Queue: Devel-Cover

People
Owner: Nobody in particular
Requestors: bricas [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.73
Fixed in: (no value)



Subject: Math::BigInt ':constant' confuses branch coverage
Download (untitled) / with headers
text/plain 460b
The following code should give 50% branch coverage: use Math::BigInt ':constant'; my $x = 1; print $x if 1 >= $x; Instead, we get 0%. This appears to be due to the fact that the "1" in the branch condition is automatically turned into a Math::BigInt. Commenting out the "Math::BigInt" line and redoing the coverage report gives the expected result. In the false report, the branch condition appears as follows: if {sign => '+', value => [1]} >= $x Cheers.
Subject: overload::constant confuses branch coverage
Download (untitled) / with headers
text/plain 116b
FWIW, this is an issue with all modules using overload::constant. One of the more popular ones happens to be bignum.
From: heikki.j.laaksonen [...] kolumbus.fi
Download (untitled) / with headers
text/plain 420b
On Tue Dec 07 09:07:51 2010, FLORA wrote: Show quoted text
> FWIW, this is an issue with all modules using overload::constant. One of > the more popular ones happens to be bignum.
The same seems to be applied also to Readonly constants. Even though I did not find explicit overload statement from there, I assume this is the same thing with my limited Perl knowledge. For example the attached code results incorrect branch coverage.
Subject: test.t
Download test.t
text/x-perl 185b
use strict; use warnings; require "coverage.pl"; use Test::More tests => 1; is( test_readonly_coverage(), 1, 'dummy test'); is( test_posix_regexp(), 1, 'dummy test'); 1;
From: heikki.j.laaksonen [...] kolumbus.fi
Download (untitled) / with headers
text/plain 419b
On Sun Dec 19 11:09:51 2010, Hessu75 wrote: Show quoted text
> The same seems to be applied also to Readonly constants. Even though I > did not find explicit overload statement from there, I assume this is > the same thing with my limited Perl knowledge. For example the attached > code results incorrect branch coverage.
And I was not even able to use this to add more than two files properly. The second missing file with the code.
Subject: coverage.pl
Download coverage.pl
text/x-perl 626b
use strict; use warnings; use Readonly; Readonly my $REGEXP_MATCH => '2'; my @lines = ( '1', '2', '3', 'A', 'B', 'c' ); sub test_readonly_coverage{ # All branches executed. foreach my $line (@lines){ if ($line =~ /$REGEXP_MATCH/msx) { print "true ($line)\n"; } else { print "false ($line)\n"; } } return 1; } sub test_posix_regexp{ # All branches executed. foreach my $line (@lines){ if ($line =~ /[[:upper:]]/msx) { print "true ($line)\n"; } else { print "false ($line)\n"; } } return 1; } 1;
Download (untitled) / with headers
text/plain 371b
Thanks to everyone for all the information and the test cases. This is now fixed in eedecbd, and the test cases have been added as 69cd295, both of which will be in the next release. The branch condition for Math::BigInt still looks like that because that is what B::Deparse provides. I'm not sure there's too much I can do about that at the moment. Thanks again,


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.