#!./perl
-print "1..186\n";
+print "1..190\n";
#P = start of string Q = start of substr R = end of substr S = end of string
ok 186, $x eq 'aYYYYef';
}
}
+
+# [perl #24200] string corruption with lvalue sub
+
+{
+ my $foo = "a";
+ sub bar: lvalue { substr $foo, 0 }
+ bar = "XXX";
+ ok 187, bar eq 'XXX';
+ $foo = '123456789';
+ ok 188, bar eq '123456789';
+}
+
+# [perl #29149]
+{
+ my $text = "0123456789\xED ";
+ utf8::upgrade($text);
+ my $pos = 5;
+ pos($text) = $pos;
+ my $a = substr($text, $pos, $pos);
+ ok 189, substr($text,$pos,1) eq $pos;
+
+}
+
+# [perl #23765]
+{
+ my $a = pack("C", 0xbf);
+ substr($a, -1) &= chr(0xfeff);
+ ok 190, $a eq "\xbf";
+}