X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fconcat.t;h=5ef40dd8c17df2e8ec4a8cd9ff8431e6d26362b7;hb=bd7d4f4d586a396d1b104a293cce339c8d63ce5a;hp=d515a5927f6c81700f471986592f507ae1d88ee9;hpb=0165acc7988347eaec71b2c2d2a9764893f0c240;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/concat.t b/t/op/concat.t index d515a59..5ef40dd 100644 --- a/t/op/concat.t +++ b/t/op/concat.t @@ -18,7 +18,7 @@ sub ok { return $ok; } -print "1..19\n"; +print "1..28\n"; ($a, $b, $c) = qw(foo bar); @@ -107,5 +107,42 @@ sub beq { use bytes; $_[0] eq $_[1]; } { my $a; ($a .= 5) . 6; - ok($a == 5, "($a .= 5) . 6 - present since 5.000"); + ok($a == 5, '($a .= 5) . 6 - present since 5.000'); +} + +{ + # [perl #24508] optree construction bug + sub strfoo { "x" } + my ($x, $y); + $y = ($x = '' . strfoo()) . "y"; + ok( "$x,$y" eq "x,xy", 'figures out correct target' ); +} + +{ + # [perl #26905] "use bytes" doesn't apply byte semantics to concatenation + + my $p = "\xB6"; # PILCROW SIGN (ASCII/EBCDIC), 2bytes in UTF-X + my $u = "\x{100}"; + my $b = pack 'a*', "\x{100}"; + my $pu = "\xB6\x{100}"; + my $up = "\x{100}\xB6"; + my $x1 = $p; + my $y1 = $u; + + use bytes; + ok(beq($p.$u, $p.$b), "perl #26905, left eq bytes"); + ok(beq($u.$p, $b.$p), "perl #26905, right eq bytes"); + ok(!beq($p.$u, $pu), "perl #26905, left ne unicode"); + ok(!beq($u.$p, $up), "perl #26905, right ne unicode"); + + $x1 .= $u; + $x2 = $p . $u; + $y1 .= $p; + $y2 = $u . $p; + + no bytes; + ok(beq($x1, $x2), "perl #26905, left, .= vs = . in bytes"); + ok(beq($y1, $y2), "perl #26905, right, .= vs = . in bytes"); + ok(($x1 eq $x2), "perl #26905, left, .= vs = . in chars"); + ok(($y1 eq $y2), "perl #26905, right, .= vs = . in chars"); }