In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/f6f22b1fc01b8676e43ef64616ed7899a84bfec2?hp=f095462e34b22920726c6bdd6b1140fdb9a5ae39>

- Log -----------------------------------------------------------------
commit f6f22b1fc01b8676e43ef64616ed7899a84bfec2
Author: Yves Orton <[email protected]>
Date:   Mon Oct 20 10:28:12 2014 +0200

    t/re/re_tests: Add test for perl #122890

M       t/re/re_tests

commit 890fbec8b209c41a5902022a654cbd782f601bb7
Author: Yves Orton <[email protected]>
Date:   Mon Oct 20 10:27:55 2014 +0200

    t/re/re_tests: put comment in correct column

M       t/re/re_tests

commit 92b05f28a98d1b7301afb8746d17237f1a669174
Author: Yves Orton <[email protected]>
Date:   Mon Oct 20 10:26:20 2014 +0200

    Add test names to t/re/regexp.t and friends

M       t/re/regexp.t
-----------------------------------------------------------------------

Summary of changes:
 t/re/re_tests |  3 ++-
 t/re/regexp.t | 33 ++++++++++++++++++++-------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/t/re/re_tests b/t/re/re_tests
index 2c40e85..0a50071 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1888,7 +1888,8 @@ A+(*PRUNE)BC(?{}) AAABC   y       $&      AAABC
 [bcd].{2,3}aaaa        XbXaaaaa        y       -       -
 [bcd].{2,3}aaaa        Xb\x{100}aaaaa  y       -       -
 '\Awibble\z'm  wibble  y       -       -
-/(alias|status)es$/i   Statuses        y       $1      Status  # [perl #121778]
+/(alias|status)es$/i   Statuses        y       $1      Status          # [perl 
#121778]
+/( (?&solution) | % ) \Z (?(DEFINE) (?<solution>7\%\ solution) )/x     7% 
solution     y       $1      7% solution             # [perl #122890]
 
 # Keep these lines at the end of the file
 # vim: softtabstop=0 noexpandtab
diff --git a/t/re/regexp.t b/t/re/regexp.t
index 59680fb..7e104db 100644
--- a/t/re/regexp.t
+++ b/t/re/regexp.t
@@ -99,13 +99,15 @@ TEST:
 foreach (@tests) {
     $test++;
     if (!/\S/ || /^\s*#/ || /^__END__$/) {
-        print "ok $test # (Blank line or comment)\n";
-        if (/#/) { print $_ };
+        chomp;
+        my ($not,$comment)= split /\s*#\s*/, $_, 2;
+        $comment ||= "(blank line)";
+        print "ok $test # $comment\n";
         next;
     }
     chomp;
     s/\\n/\n/g unless $regex_sets;
-    my ($pat, $subject, $result, $repl, $expect, $reason) = split(/\t/,$_,6);
+    my ($pat, $subject, $result, $repl, $expect, $reason, $comment) = 
split(/\t/,$_,7);
     if (!defined $subject) {
         die "Bad test definition on line $test: $_\n";
     }
@@ -130,6 +132,11 @@ foreach (@tests) {
     $reason = 'skipping $&' if $reason eq  '' && $skip_amp;
     $result =~ s/B//i unless $skip;
     my $todo= $result =~ s/T// ? " # TODO" : "";
+    my $testname= $test;
+    if ($comment) {
+        $comment=~s/^\s*(?:#\s*)?//;
+        $testname .= " - $comment" if $comment;
+    }
     if (! $skip && $regex_sets) {
 
         # If testing regex sets, change the [bracketed] classes into
@@ -169,7 +176,7 @@ foreach (@tests) {
                                 $reason = "Can't handle compilation errors 
with unmatched '{'";
                             }
                             else {
-                                print "not ok $test # Problem in $0; original 
= '$pat'; mod = '$modified'\n";
+                                print "not ok $testname # Problem in $0; 
original = '$pat'; mod = '$modified'\n";
                                 next TEST;
                             }
                         }
@@ -302,7 +309,7 @@ foreach (@tests) {
                     $reason = "Can't figure out where to put the (?[ and ]) 
since is a compilation error";
                 }
                 else {
-                    print "not ok $test # Problem in $0; original = '$pat'; 
mod = '$modified'\n";
+                    print "not ok $testname # Problem in $0; original = 
'$pat'; mod = '$modified'\n";
                     next TEST;
                 }
             }
@@ -365,22 +372,22 @@ EOFCODE
        }
        chomp( my $err = $@ );
        if ( $skip ) {
-           print "ok $test # skipped", length($reason) ? ".  $reason" : '', 
"\n";
+           print "ok $testname # skipped", length($reason) ? ".  $reason" : 
'', "\n";
            next TEST;
        }
        elsif ($result eq 'c') {
-           if ($err !~ m!^\Q$expect!) { print "not ok $test$todo (compile) 
$input => '$err'\n"; next TEST }
+           if ($err !~ m!^\Q$expect!) { print "not ok $testname$todo (compile) 
$input => '$err'\n"; next TEST }
            last;  # no need to study a syntax error
        }
        elsif ( $todo_qr ) {
-           print "not ok $test # TODO", length($reason) ? " - $reason" : '', 
"\n";
+           print "not ok $testname # TODO", length($reason) ? " - $reason" : 
'', "\n";
            next TEST;
        }
        elsif ($@) {
-           print "not ok $test$todo $input => error '$err'\n", 
_comment("$code\n$@\n"); next TEST;
+           print "not ok $testname$todo $input => error '$err'\n", 
_comment("$code\n$@\n"); next TEST;
        }
        elsif ($result =~ /^n/) {
-           if ($match) { print "not ok $test$todo ($study) $input => false 
positive\n"; next TEST }
+           if ($match) { print "not ok $testname$todo ($study) $input => false 
positive\n"; next TEST }
        }
        else {
            if (!$match || $got ne $expect) {
@@ -391,18 +398,18 @@ EOFCODE
                    # anger as it tries to load B. I'd prefer to keep the
                    # regular calls below outside of an eval so that real
                    # (unknown) failures get spotted, not ignored.
-                   print "not ok $test$todo ($study) $input => '$got', 
match=$match\n", _comment("$code\n");
+                   print "not ok $testname$todo ($study) $input => '$got', 
match=$match\n", _comment("$code\n");
                }
                else { # better diagnostics
                    my $s = 
Data::Dumper->new([$subject],['subject'])->Useqq(1)->Dump;
                    my $g = Data::Dumper->new([$got],['got'])->Useqq(1)->Dump;
-                   print "not ok $test$todo ($study) $input => '$got', 
match=$match\n", _comment("$s\n$g\n$code\n");
+                   print "not ok $testname$todo ($study) $input => '$got', 
match=$match\n", _comment("$s\n$g\n$code\n");
                }
                next TEST;
            }
        }
     }
-    print "ok $test$todo\n";
+    print "ok $testname$todo\n";
 }
 
 1;

--
Perl5 Master Repository

Reply via email to