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: 80340
Status: open
Priority: 0/
Queue: Devel-Cover

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

Bug Information
Severity: Unimportant
Broken in: 0.96
Fixed in: (no value)



Subject: Block before "continue" is ignored
Devel::Cover does not have coverage statistics for a foreach block if a continue block is following. See the attached script. If I remove the "my $x" in the test script (and replace $x by $_), then there are coverage statistics for the block. In both cases there's no coverage for the continue block. I tested this with perl 5.12.4 on FreeBSD 9.0, using the cmdline /usr/perl5.12.4/bin/perl -MDevel::Cover simple.pl ; /usr/perl5.12.4/bin/cover Regards, Slaven
Subject: simple.pl
#!/usr/bin/perl use strict; use Test::More 'no_plan'; my @x = ('a'..'c'); my $foo; my $n = 0; foreach (@x) { $foo .= $_; } continue { $n++; } is $foo, 'abc'; is $n, 3; __END__
On Mon Oct 22 16:54:27 2012, SREZIC wrote: Show quoted text
> Devel::Cover does not have coverage statistics for a foreach block if a > continue block is following. See the attached script. If I remove the > "my $x" in the test script (and replace $x by $_), then there are > coverage statistics for the block. In both cases there's no coverage for > the continue block. > > I tested this with perl 5.12.4 on FreeBSD 9.0, using the cmdline > > /usr/perl5.12.4/bin/perl -MDevel::Cover simple.pl ; > /usr/perl5.12.4/bin/cover > > Regards, > Slaven
Using Perl 5.16.0 and Devel::Cover 1.0, I was unable to reproduce this problem. I downloaded your file, renaming it as 80340_simple.pl. I then ran the following and got the output displayed: ########## $ perl -MDevel::Cover 80340_simple.pl Devel::Cover 1.00: Collecting coverage data for branch, condition, pod, statement, subroutine and time. Selecting packages matching: Ignoring packages matching: /Devel/Cover[./] Ignoring packages in: /usr/local/lib/perl5/site_perl/5.16.0/darwin-2level /usr/local/lib/perl5/site_perl/5.16.0 /usr/local/lib/perl5/5.16.0/darwin-2level /usr/local/lib/perl5/5.16.0 /usr/local/lib/perl5/site_perl/5.14.2 /usr/local/lib/perl5/site_perl/5.14.0 /usr/local/lib/perl5/site_perl/5.12.0 /usr/local/lib/perl5/site_perl/5.10.1 /usr/local/lib/perl5/site_perl/5.10.0 /usr/local/lib/perl5/site_perl ok 1 ok 2 1..2 Devel::Cover: Writing coverage database to /Users/jimk/Documents/AAAPerl/Devel-Cover/80340/cover_db/runs/1365765976.464.42338 ---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ 80340_simple.pl 100.0 n/a n/a 100.0 n/a 100.0 100.0 Total 100.0 n/a n/a 100.0 n/a 100.0 100.0 ---------------------------- ------ ------ ------ ------ ------ ------ ------ $ cover -report=text > 80340_coverage.txt I am attaching 80340_coverage.txt. Note that all statements are covered, including those in the 'foreach' block before the 'continue' block. I recommend this ticket be closed. Thank you very much. Jim Keenan
Subject: 80340_coverage.txt
Reading database from /Users/jimk/Documents/AAAPerl/Devel-Cover/80340/cover_db ---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ 80340_simple.pl 100.0 n/a n/a 100.0 n/a 100.0 100.0 Total 100.0 n/a n/a 100.0 n/a 100.0 100.0 ---------------------------- ------ ------ ------ ------ ------ ------ ------ Run: 80340_simple.pl Perl version: 5.16.0 OS: darwin Start: Fri Apr 12 11:26:15 2013 Finish: Fri Apr 12 11:26:15 2013 80340_simple.pl line err stmt bran cond sub pod time code 1 #!/usr/bin/perl 2 3 1 1 56264 use strict; 1 8 1 361 4 1 1 5385 use Test::More 'no_plan'; 1 72096 1 86 5 6 1 544923 my @x = ('a'..'c'); 7 8 1 12 my $foo; 9 1 5 my $n = 0; 10 1 627 foreach (@x) { 11 3 27 $foo .= $_; 12 } continue { 13 3 19 $n++; 14 } 15 16 1 99 is $foo, 'abc'; 17 1 1880 is $n, 3; 18 19 __END__ Covered Subroutines ------------------- Subroutine Count Location ---------- ----- ----------------- BEGIN 1 80340_simple.pl:3 BEGIN 1 80340_simple.pl:4