Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix up golden results generation for md5.t

  • Loading branch information...
commit cb81c82469ba94c60c963bfea42a098dce191932 1 parent a4e99e8
@pjcj authored
View
28 lib/Devel/Cover/Test.pm
@@ -293,6 +293,7 @@ sub run_test
ok 1 for @cover;
}
close T or die "Cannot close $cover_com: $!";
+ $self->{end}->() if $self->{end};
}
sub create_gold
@@ -325,7 +326,6 @@ sub create_gold
print "Running cover [$cover_com]\n" if $debug;
open G, ">$new_gold" or die "Cannot open $new_gold: $!";
-
open T, "$cover_com|" or die "Cannot run $cover_com: $!";
while (my $l = <T>)
{
@@ -337,27 +337,29 @@ sub create_gold
$ng .= $l;
}
close T or die "Cannot close $cover_com: $!";
-
close G or die "Cannot close $new_gold: $!";
- return if $gv eq "5.0" || $gv eq $];
-
- open G, "$gold" or die "Cannot open $gold: $!";
- my $g = do { local $/; <G> };
- close G or die "Cannot close $gold: $!";
-
- # print "checking $new_gold against $gold\n";
- if ($ng eq $g)
+ unless ($gv eq "5.0" || $gv eq $])
{
- print "Output from $new_gold matches $gold\n";
- unlink $new_gold;
+ open G, "$gold" or die "Cannot open $gold: $!";
+ my $g = do { local $/; <G> };
+ close G or die "Cannot close $gold: $!";
+
+ # print "checking $new_gold against $gold\n";
+ if ($ng eq $g)
+ {
+ print "Output from $new_gold matches $gold\n";
+ unlink $new_gold;
+ }
}
+
+ $self->{end}->() if $self->{end};
}
END
{
my $self = $Test;
- $self->run_test if $self->{run_test_at_end};
+ $self->run_test if $self->{run_test_at_end};
}
1;
View
6 test_output/cover/trivial_md5.5.006001 → test_output/cover/md5.5.006001
@@ -1,11 +1,11 @@
Reading database from /home/pjcj/g/perl/Devel-Cover/cover_db
-Devel::Cover: Deleting old coverage for changed file tests/trivial_md5
+Devel::Cover: Deleting old coverage for changed file tests/md5
------------------------------------------ ------ ------ ------ ------ ------
File stmt bran cond sub total
------------------------------------------ ------ ------ ------ ------ ------
-tests/trivial_md5 100.0 n/a n/a n/a 100.0
+tests/md5 100.0 n/a n/a n/a 100.0
Total 100.0 n/a n/a n/a 100.0
------------------------------------------ ------ ------ ------ ------ ------
@@ -22,7 +22,7 @@ OS: ...
Start: ...
Finish: ...
-tests/trivial_md5
+tests/md5
line err stmt bran cond sub code
1 #!/usr/bin/perl
View
5 tests/md5.t
@@ -17,7 +17,7 @@ use Devel::Cover::Test 0.53;
my $base = $Devel::Cover::Inc::Base;
-my $t = "trivial_md5";
+my $t = "md5";
my $ft = "$base/tests/$t";
my $fg = "$base/tests/trivial";
@@ -43,6 +43,5 @@ my $test = Devel::Cover::Test->new
(
$t,
run_test => $run_test,
+ end => sub { unlink $ft },
);
-
-END { unlink $ft }
Please sign in to comment.
Something went wrong with that request. Please try again.