Fix 29149 - another UTF8 cache bug hit by substr.
[p5sagit/p5-mst-13.2.git] / t / op / substr.t
index 681ac6d..08f4165 100755 (executable)
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..188\n";
+print "1..189\n";
 
 #P = start of string  Q = start of substr  R = end of substr  S = end of string
 
@@ -640,3 +640,14 @@ ok 174, $x eq "\x{100}\x{200}\xFFb";
     $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;
+
+}