This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test line number for (??{$str}) regexp warnings
authorFather Chrysostomos <sprout@cpan.org>
Sun, 24 Nov 2013 06:36:26 +0000 (22:36 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 24 Nov 2013 15:45:51 +0000 (07:45 -0800)
If the (??{}) does not occur on the same line as the match operator
(e.g., if we have /foo$qr/ and $qr has (??{}) in it), we need to
make sure warnings that occur when the return value of (??{}) is
compiled use the same line number as the /.../, since conceptually
it is part of matching, not part of returning.

I tried breaking this and making the line number wrong, but all
tests passed, showing that it is untested.  Most regcomp tests are in
t/re/reg_mesg.t, but that file does not have infrastructure for check-
ing line numbers.

t/lib/warnings/regcomp

index 19b6b06..b55959e 100644 (file)
@@ -1,3 +1,9 @@
   regcomp.c    These tests have been moved to t/re/reg_mesg.t
+               except for those that explicitly test line numbers.
 
 __END__
+use warnings 'regexp';
+$r=qr/(??{ q"\\b+" })/;
+"a" =~ /a$r/; # warning should come from this line
+EXPECT
+\b+ matches null string many times in regex; marked by <-- HERE in m/\b+ <-- HERE / at - line 3.