diff options
author | Matthew Horsfall (alh) <wolfsage@gmail.com> | 2013-09-17 08:49:35 -0400 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-09-17 12:36:04 -0700 |
commit | f1deee33127f317d04081ad769f003385b22e490 (patch) | |
tree | 8231b4b42781c6c09648f16910b63927aa4bb384 /lib/diagnostics.t | |
parent | 942cddc4751d3a9bac11ba8309e93afc6e62a5cf (diff) | |
download | perl-f1deee33127f317d04081ad769f003385b22e490.tar.gz |
RT-119817 - Treat =back as the end of a warning description.
This keeps any trailing data in the file from showing up as part
of the last warning's description.
Diffstat (limited to 'lib/diagnostics.t')
-rw-r--r-- | lib/diagnostics.t | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/lib/diagnostics.t b/lib/diagnostics.t index a7e31e110f..0328522d80 100644 --- a/lib/diagnostics.t +++ b/lib/diagnostics.t @@ -4,7 +4,7 @@ BEGIN { chdir '..' if -d '../pod' && -d '../t'; @INC = 'lib'; require './t/test.pl'; - plan(25); + plan(28); } BEGIN { @@ -136,6 +136,48 @@ like $warning, qr/Auto-increment.*Auto-decrement/s, 'multiline links are not truncated'; +{ +# Find last warning in perldiag.pod, and last items if any + my $lw; + my $inlast; + my $item; + + open(my $f, '<', "pod/perldiag.pod") + or die "failed to open pod/perldiag.pod for reading: $!"; + + while (<$f>) { + if ( /^=item\s+(.*)/) { + $lw = $1; + } elsif (/^=back/) { + $inlast = 1; + } elsif ($inlast) { + # Skip headings + next if /^=/; + + # Strip specials + $_ =~ s/\w<(.*?)>/$1/g; + + # And whitespace + $_ =~ s/(^\s+|\s+$)//g; + + if ($_) { + $item = $_; + + last; + } + } + } + close($f); + + ok($item, "(sanity...) found an item to check with ($item)"); + seek STDERR, 0,0; + $warning = ''; + warn $lw; + ok($warning, '(sanity...) got a warning'); + unlike $warning, + qr/\Q$item\E/, + "Junk after =back doesn't show up in last warning"; +} *STDERR = $old_stderr; |