diff options
Diffstat (limited to 'gnu/usr.bin/perl/t/op/substr.t')
-rw-r--r-- | gnu/usr.bin/perl/t/op/substr.t | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gnu/usr.bin/perl/t/op/substr.t b/gnu/usr.bin/perl/t/op/substr.t index dfb483aee58..5a99531205a 100644 --- a/gnu/usr.bin/perl/t/op/substr.t +++ b/gnu/usr.bin/perl/t/op/substr.t @@ -1,6 +1,6 @@ #!./perl -print "1..177\n"; +print "1..181\n"; #P = start of string Q = start of substr R = end of substr S = end of string @@ -609,3 +609,32 @@ ok 174, $x eq "\x{100}\x{200}\xFFb"; my $y = substr $x, 4; ok 177, substr($x, 7, 1) eq "7"; } + +# [perl #24200] string corruption with lvalue sub + +{ + my $foo = "a"; + sub bar: lvalue { substr $foo, 0 } + bar = "XXX"; + ok 178, bar eq 'XXX'; + $foo = '123456789'; + ok 179, 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 180, substr($text,$pos,1) eq $pos; + +} + +# [perl #23765] +{ + my $a = pack("C", 0xbf); + substr($a, -1) &= chr(0xfeff); + ok 181, $a eq "\xbf"; +} |