Make C<undef ~~ 0> and C<undef ~~ ""> not match (like in 5.10.0)
[p5sagit/p5-mst-13.2.git] / t / op / rxcode.t
index 18b1b3e..eb144f9 100644 (file)
@@ -1,4 +1,12 @@
-use Test::More tests => 34;
+#!./perl
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+    require './test.pl';
+}
+
+plan tests => 38;
 
 $^R = undef;
 like( 'a',  qr/^a(?{1})(?:b(?{2}))?/, 'a =~ ab?' );
@@ -15,10 +23,7 @@ cmp_ok( $^R, '==', 6, '..$^R after ab =~ ab' );
 $^R = undef;
 like( 'ab', qr/^a(?{7})(?:b(?{8}))?/, 'ab =~ ab?' );
 
-TODO: {
-    local $TODO = '#32840: $^R value lost in (?:...)? constructs';
-    cmp_ok( $^R, '==', 8, '..$^R after ab =~ ab?' );
-}
+cmp_ok( $^R, '==', 8, '..$^R after ab =~ ab?' );
 
 $^R = undef;
 like( 'ab', qr/^a(?{9})b?(?{10})/, 'ab =~ ab? (2)' );
@@ -26,10 +31,7 @@ cmp_ok( $^R, '==', 10, '..$^R after ab =~ ab? (2)' );
 
 $^R = undef;
 like( 'ab', qr/^(a(?{11})(?:b(?{12})))?/, 'ab =~ (ab)? (3)' );
-TODO: {
-    local $TODO = '#32840: $^R value lost in (?:...)? constructs (2)';
-    cmp_ok( $^R, '==', 12, '..$^R after ab =~ ab? (3)' );
-}
+cmp_ok( $^R, '==', 12, '..$^R after ab =~ ab? (3)' );
 
 $^R = undef;
 unlike( 'ac', qr/^a(?{13})b(?{14})/, 'ac !~ ab' );
@@ -72,3 +74,13 @@ cmp_ok( scalar(@var), '==', 0, '..nothing pushed (package)' );
 unlike( 'abc', qr/^a(?{push @var,113})b(?{push @var,114})$/, 'abc !~ ab$ (push package var)' );
 cmp_ok( scalar(@var), '==', 0, '..still nothing pushed (package)' );
 
+{
+    local $^R = undef;
+    ok( 'ac' =~ /^a(?{30})(?:b(?{31})|c(?{32}))?/, 'ac =~ a(?:b|c)?' );
+    ok( $^R == 32, '$^R == 32' );
+}
+{
+    local $^R = undef;
+    ok( 'abbb' =~ /^a(?{36})(?:b(?{37})|c(?{38}))+/, 'abbbb =~ a(?:b|c)+' );
+    ok( $^R == 37, '$^R == 37' ) or print "# \$^R=$^R\n";
+}