From: Dave Mitchell Date: Mon, 1 Mar 2004 22:17:52 +0000 (+0000) Subject: add tests for change 22414 (lvalue substr jollity) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2552146e69e1443c4d03b9239099002cac71b95;p=p5sagit%2Fp5-mst-13.2.git add tests for change 22414 (lvalue substr jollity) courtesy of Graham Barr. p4raw-id: //depot/perl@22419 --- diff --git a/t/op/substr.t b/t/op/substr.t index dfb483a..ad35dce 100755 --- a/t/op/substr.t +++ b/t/op/substr.t @@ -1,6 +1,6 @@ #!./perl -print "1..177\n"; +print "1..186\n"; #P = start of string Q = start of substr R = end of substr S = end of string @@ -609,3 +609,23 @@ ok 174, $x eq "\x{100}\x{200}\xFFb"; my $y = substr $x, 4; ok 177, substr($x, 7, 1) eq "7"; } + +# multiple assignments to lvalue [perl #24346] +{ + my $x = "abcdef"; + for (substr($x,1,3)) { + ok 178, $_ eq 'bcd'; + $_ = 'XX'; + ok 179, $_ eq 'XX'; + ok 180, $x eq 'aXXef'; + $_ = "\xFF"; + ok 181, $_ eq "\xFF"; + ok 182, $x eq "a\xFFef"; + $_ = "\xF1\xF2\xF3\xF4\xF5\xF6"; + ok 183, $_ eq "\xF1\xF2\xF3\xF4\xF5\xF6"; + ok 184, $x eq "a\xF1\xF2\xF3\xF4\xF5\xF6ef"; + $_ = 'YYYY'; + ok 185, $_ eq 'YYYY'; + ok 186, $x eq 'aYYYYef'; + } +}