This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move t/re/reg_unsafe.t's test to a fresh_perl_is() inside pat_advanced.t
authorNicholas Clark <nick@ccl4.org>
Sun, 13 Mar 2011 16:42:50 +0000 (16:42 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 13 Mar 2011 16:42:50 +0000 (16:42 +0000)
Add a passing variant which mentions $&. Note the bug number (#86042) in the
TODO test.

MANIFEST
t/re/pat_advanced.t
t/re/reg_unsafe.t [deleted file]

index 06e0206..ad3a116 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -5053,7 +5053,6 @@ t/re/reg_namedcapture.t           Make sure glob assignment doesn't break named capture
 t/re/reg_nc_tie.t              Test the tied methods of Tie::Hash::NamedCapture
 t/re/reg_pmod.t                        See if regexp /p modifier works as expected
 t/re/reg_posixcc.t             See if posix character classes behave consistently
-t/re/reg_unsafe.t              Check for unsafe match vars
 t/re/re_tests                  Regular expressions for regexp.t
 t/re/rxcode.t                  See if /(?{ code })/ works
 t/re/subst_amp.t               See if $&-related substitution works
index 3e7390d..f9b91fb 100644 (file)
@@ -1657,6 +1657,22 @@ sub run_tests {
         ($_ = 'abc') =~ /(abc)/g;
         $_ = '123';
         is("$1", 'abc', "/g leads to unsafe match vars: $1");
+
+        fresh_perl_is(<<'EOP', ">abc<\n", {}, 'mention $&');
+$&;
+my $x; 
+($x='abc')=~/(abc)/g; 
+$x='123'; 
+print ">$1<\n";
+EOP
+
+        local $::TODO = 'RT #86042';
+        fresh_perl_is(<<'EOP', ">abc<\n", {}, 'no mention of $&');
+my $x; 
+($x='abc')=~/(abc)/g; 
+$x='123'; 
+print ">$1<\n";
+EOP
     }
 
     {
diff --git a/t/re/reg_unsafe.t b/t/re/reg_unsafe.t
deleted file mode 100644 (file)
index 49c7011..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!./perl
-
-BEGIN {
-    chdir 't' if -d 't';
-    @INC = '../lib';
-    
-}
-print "1..1\n";
-
-# there is an equivalent test in t/re/pat.t which does NOT fail
-# its not clear why it doesn't fail, so this todo gets its own test
-# file until we can work it out.
-
-my $x; 
-($x='abc')=~/(abc)/g; 
-$x='123'; 
-
-print "not " if $1 ne 'abc';
-print "ok 1 # TODO safe match vars make /g slow\n";