This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reënable qr caching for (??{}) retval where possible
[perl5.git] / t / re / recompile.t
index 63a7068..f026fae 100644 (file)
@@ -22,7 +22,7 @@ BEGIN {
 }
 
 
-plan tests => 38;
+plan tests => 46;
 
 my $results = runperl(
                        switches => [ '-Dr' ],
@@ -193,3 +193,20 @@ my $x = qr/a/i;
 my $y = qr/a/;
 "a" =~ qr/a$_/ for $x, $y, $x, $y;
 CODE
+
+comp_n(2, <<'CODE', '(??{"constant"})');
+"bb" =~ /(??{"abc"})/;
+CODE
+
+comp_n(2, <<'CODE', '(??{"folded"."constant"})');
+"bb" =~ /(??{"ab"."c"})/;
+CODE
+
+comp_n(2, <<'CODE', '(??{$preused_scalar})');
+$s = "abc";
+"bb" =~ /(??{$s})/;
+CODE
+
+comp_n(2, <<'CODE', '(??{number})');
+"bb" =~ /(??{123})/;
+CODE