summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2018-04-19 19:04:49 +0200
committerDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2018-04-19 19:04:49 +0200
commit6fb6725b9a4650ad6dd2958c77632ec36c1ffdca (patch)
tree91943ebe2ef38bf6d1d2e0f847b988936d3c1fbc
parenta48dcd62c1ff5b80154db362a0316c2615147d59 (diff)
downloadperl-6fb6725b9a4650ad6dd2958c77632ec36c1ffdca.tar.gz
Devel-PPPort Include line numbers in ppphtest.t debug output
-rw-r--r--dist/Devel-PPPort/parts/inc/ppphtest13
-rw-r--r--dist/Devel-PPPort/t/ppphtest.t13
2 files changed, 12 insertions, 14 deletions
diff --git a/dist/Devel-PPPort/parts/inc/ppphtest b/dist/Devel-PPPort/parts/inc/ppphtest
index 925929d668..2be4331563 100644
--- a/dist/Devel-PPPort/parts/inc/ppphtest
+++ b/dist/Devel-PPPort/parts/inc/ppphtest
@@ -75,7 +75,8 @@ ok(Devel::PPPort::GetFileContents(), $data);
sub comment
{
my $c = shift;
- $c =~ s/^/# | /mg;
+ my $x = 0;
+ $c =~ s/^/sprintf("# %2d| ", ++$x)/meg;
$c .= "\n" unless $c =~ /[\r\n]$/;
print $c;
}
@@ -154,14 +155,12 @@ for $t (@tests) {
open F, ">$f" or die "open $f: $!\n";
print F "$txt\n";
close F;
- $txt =~ s/^/# | /mg;
- print "# *** writing $f ***\n$txt\n";
+ print "# *** writing $f ***\n";
+ comment($txt);
}
- my $code = $t->{code};
- $code =~ s/^/# | /mg;
-
- print "# *** evaluating test code ***\n$code\n";
+ print "# *** evaluating test code ***\n";
+ comment($t->{code});
eval $t->{code};
if ($@) {
diff --git a/dist/Devel-PPPort/t/ppphtest.t b/dist/Devel-PPPort/t/ppphtest.t
index 90d7d24ab8..af2db3f43a 100644
--- a/dist/Devel-PPPort/t/ppphtest.t
+++ b/dist/Devel-PPPort/t/ppphtest.t
@@ -112,7 +112,8 @@ ok(Devel::PPPort::GetFileContents(), $data);
sub comment
{
my $c = shift;
- $c =~ s/^/# | /mg;
+ my $x = 0;
+ $c =~ s/^/sprintf("# %2d| ", ++$x)/meg;
$c .= "\n" unless $c =~ /[\r\n]$/;
print $c;
}
@@ -191,14 +192,12 @@ for $t (@tests) {
open F, ">$f" or die "open $f: $!\n";
print F "$txt\n";
close F;
- $txt =~ s/^/# | /mg;
- print "# *** writing $f ***\n$txt\n";
+ print "# *** writing $f ***\n";
+ comment($txt);
}
- my $code = $t->{code};
- $code =~ s/^/# | /mg;
-
- print "# *** evaluating test code ***\n$code\n";
+ print "# *** evaluating test code ***\n";
+ comment($t->{code});
eval $t->{code};
if ($@) {