Lots of consting
[p5sagit/p5-mst-13.2.git] / t / op / subst.t
index ef0ae0a..148b5db 100755 (executable)
@@ -7,7 +7,7 @@ BEGIN {
 }
 
 require './test.pl';
-plan( tests => 124 );
+plan( tests => 130 );
 
 $x = 'foo';
 $_ = "x";
@@ -494,9 +494,48 @@ SKIP: {
 $_ = 'aaaa';
 $r = 'x';
 $s = s/a(?{})/$r/g;
-is("<$_> <$s>", "<xxxx> <4>", "perl #7806");
+is("<$_> <$s>", "<xxxx> <4>", "[perl #7806]");
 
 $_ = 'aaaa';
 $s = s/a(?{})//g;
-is("<$_> <$s>", "<> <4>", "perl #7806");
+is("<$_> <$s>", "<> <4>", "[perl #7806]");
 
+# [perl #19048] Coredump in silly replacement
+{
+    local $^W = 0;
+    $_="abcdef\n";
+    s!.!!eg;
+    is($_, "\n", "[perl #19048]");
+}
+
+# [perl #17757] interaction between saw_ampersand and study
+{
+    my $f = eval q{ $& };
+    $f = "xx";
+    study $f;
+    $f =~ s/x/y/g;
+    is($f, "yy", "[perl #17757]");
+}
+
+# [perl #20684] returned a zero count
+$_ = "1111";
+is(s/(??{1})/2/eg, 4, '#20684 s/// with (??{..}) inside');
+
+# [perl #20682] @- not visible in replacement
+$_ = "123";
+/(2)/; # seed @- with something else
+s/(1)(2)(3)/$#- (@-)/;
+is($_, "3 (0 0 1 2)", '#20682 @- not visible in replacement');
+
+# [perl #20682] $^N not visible in replacement
+$_ = "abc";
+/(a)/; s/(b)|(c)/-$^N/g;
+is($_,'a-b-c','#20682 $^N not visible in replacement');
+
+# [perl #22351] perl bug with 'e' substitution modifier
+my $name = "chris";
+{
+    no warnings 'uninitialized';
+    $name =~ s/hr//e;
+}
+is($name, "cis", q[#22351 bug with 'e' substitution modifier]);