summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthew Horsfall <wolfsage@gmail.com>2011-07-07 23:58:03 -0400
committerFather Chrysostomos <sprout@cpan.org>2011-07-08 09:10:46 -0700
commitc0d3a21f46f3cadad5c0a3742b410670d83e10a4 (patch)
tree56e3ef58cf842075d9ab5167e47d7b14872077fb /lib
parent7c4c6e7cb76c912fc1c4218cf14243fc37bd530a (diff)
downloadperl-c0d3a21f46f3cadad5c0a3742b410670d83e10a4.tar.gz
Allow items in perldiag.pod to match warnings when they have periods at the end
Diffstat (limited to 'lib')
-rw-r--r--lib/diagnostics.pm3
-rw-r--r--lib/diagnostics.t7
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm
index b3464488d7..f9308b6c50 100644
--- a/lib/diagnostics.pm
+++ b/lib/diagnostics.pm
@@ -407,6 +407,9 @@ my %msg;
# strip formatting directives from =item line
$header =~ s/[A-Z]<(.*?)>/$1/g;
+ # Since we strip "\.\n" when we search a warning, strip it here as well
+ $header =~ s/\.?$//;
+
my @toks = split( /(%l?[dx]|%c|%(?:\.\d+)?[fs])/, $header );
if (@toks > 1) {
my $conlen = 0;
diff --git a/lib/diagnostics.t b/lib/diagnostics.t
index dae2754b0d..1dc8ec3a57 100644
--- a/lib/diagnostics.t
+++ b/lib/diagnostics.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = 'lib';
}
-use Test::More tests => 6;
+use Test::More tests => 7;
BEGIN { use_ok('diagnostics') }
@@ -44,3 +44,8 @@ warn 'Code point 0x%X is not Unicode, may not be portable';
like $warning, qr/W utf8/,
'Message sharing its description with the following message';
+# Periods at end of entries in perldiag.pod get matched correctly
+seek STDERR, 0,0;
+$warning = '';
+warn "Execution of -e aborted due to compilation errors.\n";
+like $warning, qr/The final summary message/, 'Periods at end of line';