Skip to content
Browse files

import Devel::Cover 0.17

  • Loading branch information...
1 parent 434aad5 commit 0b957fb5c93c989b2d9d421dbc95cc863789846d @pjcj committed Nov 3, 2004
View
4 CHANGES
@@ -90,3 +90,7 @@ Release 0.16 - 9th September 2002
- Inline the HTML templates.
- Rebless the op after blessing it as a COP.
- Make branch coverage line numbers more accurate.
+
+Release 0.17 - 15th September 2002
+ - Call check_files() in report() to ensure we pick up anything added
+ to the symbol table while the program was running.
View
4 Makefile.PL
@@ -18,8 +18,8 @@ use ExtUtils::MakeMaker;
$| = 1;
-my $Version = "0.16";
-my $Date = "9th September 2002";
+my $Version = "0.17";
+my $Date = "15th September 2002";
my $Author = 'pjcj@cpan.org';
my @perlbug = ("perlbug", "-a", $Author,
View
6 cover
@@ -12,9 +12,9 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
-use Devel::Cover::DB 0.16;
+use Devel::Cover::DB 0.17;
use Getopt::Long;
@@ -185,7 +185,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
4 create_gold
@@ -12,11 +12,11 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use blib;
-use Devel::Cover::Test 0.16;
+use Devel::Cover::Test 0.17;
my @tests = @ARGV;
View
6 gcov2perl
@@ -12,9 +12,9 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
-use Devel::Cover::DB 0.16;
+use Devel::Cover::DB 0.17;
use Getopt::Long;
use Pod::Usage;
@@ -128,7 +128,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
67 lib/Devel/Cover.pm
@@ -11,12 +11,12 @@ use strict;
use warnings;
our @ISA = qw( DynaLoader );
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use DynaLoader ();
-use Devel::Cover::DB 0.16;
-use Devel::Cover::Inc 0.16;
+use Devel::Cover::DB 0.17;
+use Devel::Cover::Inc 0.17;
use B qw( class ppname main_cv main_start main_root walksymtable OPf_KIDS );
use B::Debug;
@@ -182,6 +182,8 @@ sub get_location
$File =~ s/ \(autosplit into .*\)$//;
$File =~ s/^$Cwd\///;
+
+ # print "File: $File\n";
}
sub use_file
@@ -200,41 +202,46 @@ sub use_file
$files->{$file}
}
-sub B::GV::find_cv
+sub check_file
{
- return unless ${$_[0]->CV};
+ my ($cv) = @_;
+
+ return unless class($cv) eq "CV";
+
+ my $op = $cv->START;
+ return unless $op->can("file") && class($op) ne "NULL" && is_state($op);
+
+ my $file = $op->file;
+ my $use = use_file($file);
+ # printf "%6s $file\n", $use ? "use" : "ignore";
+ $use
+}
+
+sub B::GV::find_cv
+{
my $cv = $_[0]->CV;
- push @Cvs, $cv;
+ return unless $$cv;
- if ($cv->PADLIST->can("ARRAY") &&
- $cv->PADLIST->ARRAY &&
- $cv->PADLIST->ARRAY->can("ARRAY"))
- {
- push @Cvs, grep class($_) eq "CV", $cv->PADLIST->ARRAY->ARRAY;
- }
+ push @Cvs, $cv if check_file($cv);
+ push @Cvs, grep check_file($_), $cv->PADLIST->ARRAY->ARRAY
+ if $cv->PADLIST->can("ARRAY") &&
+ $cv->PADLIST->ARRAY &&
+ $cv->PADLIST->ARRAY->can("ARRAY");
};
sub check_files
{
# print "Checking files\n";
- push @Cvs, grep class($_) eq "CV", B::main_cv->PADLIST->ARRAY->ARRAY;
+ @Cvs = grep check_file($_), B::main_cv->PADLIST->ARRAY->ARRAY;
- walksymtable(\%main::, "find_cv", sub { 1 }, "");
+ my %seen_pkg;
- for my $cv (@Cvs)
- {
- my $op = $cv->START;
- # print "$op\n";
- next unless $op->can("file") && class($op) ne "NULL" && is_state($op);
-
- my $file = $op->file;
- my $use = use_file($file);
- # printf "%6s $file\n", $use ? "use" : "ignore";
- }
+ walksymtable(\%main::, "find_cv", sub { !$seen_pkg{$_[0]}++ });
# use Data::Dumper;
+ # print Dumper \%seen_pkg;
# print Dumper \%Devel::Cover::Files;
}
@@ -251,14 +258,10 @@ sub report
# use Data::Dumper;
# print Dumper $Coverage;
+ check_files();
+
get_cover(main_cv, main_root);
- for my $cv (@Cvs)
- {
- my $start = $cv->START;
- next unless $start->can("file") && use_file($start->file);
- # print "File: ", $start->file, "\n";
- get_cover($cv);
- }
+ get_cover($_) for @Cvs;
my $cover = Devel::Cover::DB->new
(
@@ -575,7 +578,7 @@ Did I mention that this is alpha code?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
4 lib/Devel/Cover/Branch.pm
@@ -10,7 +10,7 @@ package Devel::Cover::Branch;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use base "Devel::Cover::Criterion";
@@ -76,7 +76,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
4 lib/Devel/Cover/Condition.pm
@@ -10,7 +10,7 @@ package Devel::Cover::Condition;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use base "Devel::Cover::Criterion";
@@ -77,7 +77,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
4 lib/Devel/Cover/Criterion.pm
@@ -10,7 +10,7 @@ package Devel::Cover::Criterion;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
sub new
{
@@ -68,7 +68,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
18 lib/Devel/Cover/DB.pm
@@ -10,15 +10,15 @@ package Devel::Cover::DB;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
-use Devel::Cover::DB::File 0.16;
-use Devel::Cover::Criterion 0.16;
-use Devel::Cover::Statement 0.16;
-use Devel::Cover::Branch 0.16;
-use Devel::Cover::Condition 0.16;
-use Devel::Cover::Pod 0.16;
-use Devel::Cover::Time 0.16;
+use Devel::Cover::DB::File 0.17;
+use Devel::Cover::Criterion 0.17;
+use Devel::Cover::Statement 0.17;
+use Devel::Cover::Branch 0.17;
+use Devel::Cover::Condition 0.17;
+use Devel::Cover::Pod 0.17;
+use Devel::Cover::Time 0.17;
use Carp;
use Data::Dumper;
@@ -537,7 +537,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
16 lib/Devel/Cover/DB/File.pm
@@ -10,14 +10,14 @@ package Devel::Cover::DB::File;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
-use Devel::Cover::Criterion 0.16;
-use Devel::Cover::Statement 0.16;
-use Devel::Cover::Branch 0.16;
-use Devel::Cover::Condition 0.16;
-use Devel::Cover::Pod 0.16;
-use Devel::Cover::Time 0.16;
+use Devel::Cover::Criterion 0.17;
+use Devel::Cover::Statement 0.17;
+use Devel::Cover::Branch 0.17;
+use Devel::Cover::Condition 0.17;
+use Devel::Cover::Pod 0.17;
+use Devel::Cover::Time 0.17;
sub calculate_summary
{
@@ -83,7 +83,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
2 lib/Devel/Cover/Op.pm
@@ -10,7 +10,7 @@ package Devel::Cover::Op;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use Devel::Cover qw( -ignore blib -ignore \\wB\\w -indent 1 );
use B::Concise qw( set_style add_callback );
View
4 lib/Devel/Cover/Pod.pm
@@ -10,7 +10,7 @@ package Devel::Cover::Pod;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use base "Devel::Cover::Criterion";
@@ -72,7 +72,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
20 lib/Devel/Cover/Report/Html.pm
@@ -10,14 +10,14 @@ package Devel::Cover::Report::Html;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
-use Devel::Cover::DB 0.16;
-use Devel::Cover::Statement 0.16;
-use Devel::Cover::Branch 0.16;
-use Devel::Cover::Condition 0.16;
-use Devel::Cover::Pod 0.16;
-use Devel::Cover::Time 0.16;
+use Devel::Cover::DB 0.17;
+use Devel::Cover::Statement 0.17;
+use Devel::Cover::Branch 0.17;
+use Devel::Cover::Condition 0.17;
+use Devel::Cover::Pod 0.17;
+use Devel::Cover::Time 0.17;
use Cwd ();
use Template 2.00;
@@ -294,7 +294,7 @@ package Devel::Cover::Report::Html::Template::Provider;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use base "Template::Provider";
@@ -330,7 +330,7 @@ $Templates{html} = <<'EOT';
<!--
-This file was generated by Devel::Cover Version 0.16
+This file was generated by Devel::Cover Version 0.17
Devel::Cover is copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
@@ -549,7 +549,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
16 lib/Devel/Cover/Report/Text.pm
@@ -10,14 +10,14 @@ package Devel::Cover::Report::Text;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
-use Devel::Cover::DB 0.16;
-use Devel::Cover::Statement 0.16;
-use Devel::Cover::Branch 0.16;
-use Devel::Cover::Condition 0.16;
-use Devel::Cover::Pod 0.16;
-use Devel::Cover::Time 0.16;
+use Devel::Cover::DB 0.17;
+use Devel::Cover::Statement 0.17;
+use Devel::Cover::Branch 0.17;
+use Devel::Cover::Condition 0.17;
+use Devel::Cover::Pod 0.17;
+use Devel::Cover::Time 0.17;
sub print_file
{
@@ -222,7 +222,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
4 lib/Devel/Cover/Statement.pm
@@ -10,7 +10,7 @@ package Devel::Cover::Statement;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use base "Devel::Cover::Criterion";
@@ -68,7 +68,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
4 lib/Devel/Cover/Test.pm
@@ -10,14 +10,14 @@ package Devel::Cover::Test;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use Carp;
use File::Spec;
use Test;
-use Devel::Cover::Inc 0.16;
+use Devel::Cover::Inc 0.17;
sub new
{
View
4 lib/Devel/Cover/Time.pm
@@ -10,7 +10,7 @@ package Devel::Cover::Time;
use strict;
use warnings;
-our $VERSION = "0.16";
+our $VERSION = "0.17";
use base "Devel::Cover::Criterion";
@@ -69,7 +69,7 @@ Huh?
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
2 lib/Devel/Cover/Tutorial.pod
@@ -163,7 +163,7 @@ basis for future research.
=head1 VERSION
-Version 0.16 - 9th September 2002
+Version 0.17 - 15th September 2002
=head1 LICENCE
View
21 test_output/cover/eval1
@@ -26,13 +26,18 @@ line err stmt branch cond code
12
13 use lib -d "t" ? "t" : "..";
14
-15 1 eval <<EOS;
-16 sub e
-17 {
-18 1
-19 }
-20 EOS
-21
-22 1 e();
+15 1 my $x;
+16
+17 1 eval <<'EOS';
+ 1
+ 1
+18 sub e
+19 {
+20 $x++;
+21 $x
+22 }
+23 EOS
+24
+25 1 e();
View
7 tests/eval1
@@ -12,10 +12,13 @@ use warnings;
use lib -d "t" ? "t" : "..";
-eval <<EOS;
+my $x;
+
+eval <<'EOS';
sub e
{
- 1
+ $x++;
+ $x
}
EOS

0 comments on commit 0b957fb

Please sign in to comment.
Something went wrong with that request. Please try again.