Allow items in perldiag.pod to match warnings when they have periods at the end
authorMatthew Horsfall <wolfsage@gmail.com>
Fri, 8 Jul 2011 03:58:03 +0000 (23:58 -0400)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 8 Jul 2011 16:10:46 +0000 (09:10 -0700)
lib/diagnostics.pm
lib/diagnostics.t

index b346448..f9308b6 100644 (file)
@@ -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;
index dae2754..1dc8ec3 100644 (file)
@@ -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';