8 # ok()/is() functions from other sources (e.g., t/test.pl) may use
9 # concatenation, but that is what is being tested in this file. Hence, we
10 # place this file in the directory where do not use t/test.pl, and we
11 # write functions specially written to avoid any concatenation.
18 printf "%sok %d - %s\n", ($ok ? "" : "not "), $test, $name;
20 printf "# Failed test at line %d\n", (caller)[2] unless $ok;
27 my($got, $expected, $name) = @_;
29 my $ok = $got eq $expected;
31 printf "%sok %d - %s\n", ($ok ? "" : "not "), $test, $name;
34 printf "# Failed test at line %d\n", (caller)[2];
35 printf "# got: %s\n#expected: %s\n", $got, $expected;
44 ($a, $b, $c) = qw(foo bar);
46 ok("$a" eq "foo", "verifying assign");
47 ok("$a$b" eq "foobar", "basic concatenation");
48 ok("$c$a$c" eq "foo", "concatenate undef, fore and aft");
50 # Okay, so that wasn't very challenging. Let's go Unicode.
53 # bug id 20000819.004 (#3761)
55 $_ = $dx = "\x{10f2}";
58 ok($_ eq "$dx$dx","bug id 20000819.004 (#3761), back");
61 $_ = $dx = "\x{10f2}";
64 ok($_ eq "$dx$dx","bug id 20000819.004 (#3761), front");
68 $_ = "\x{10f2}\x{10f2}";
71 ok($_ eq "$dx$dx","bug id 20000819.004 (#3761), front and back");
76 # bug id 20000901.092 (#4184)
77 # test that undef left and right of utf8 results in a valid string
81 ok($a eq "\x{1ff}", "bug id 20000901.092 (#4184), undef left");
83 ok($a eq "\x{1ff}", "bug id 20000901.092 (#4184), undef right");
87 # ID 20001020.006 (#4484)
89 "x" =~ /(.)/; # unset $2
91 # Without the fix this 5.7.0 would croak:
92 # Modification of a read-only value attempted at ...
94 ok(!$@, "bug id 20001020.006 (#4484), left");
96 # For symmetry with the above.
98 ok(!$@, "bug id 20001020.006 (#4484), right");
101 # This bug existed earlier than the $2 bug, but is fixed with the same
102 # patch. Without the fix this 5.7.0 would also croak:
103 # Modification of a read-only value attempted at ...
105 ok(!$@, "bug id 20001020.006 (#4484), constant left");
107 # For symmetry with the above.
109 ok(!$@, "bug id 20001020.006 (#4484), constant right");
112 sub beq { use bytes; $_[0] eq $_[1]; }
115 # concat should not upgrade its arguments.
118 ($l, $r, $c) = ("\x{101}", "\x{fe}", "\x{101}\x{fe}");
119 ok(beq($l.$r, $c), "concat utf8 and byte");
120 ok(beq($l, "\x{101}"), "right not changed after concat u+b");
121 ok(beq($r, "\x{fe}"), "left not changed after concat u+b");
123 ($l, $r, $c) = ("\x{fe}", "\x{101}", "\x{fe}\x{101}");
124 ok(beq($l.$r, $c), "concat byte and utf8");
125 ok(beq($l, "\x{fe}"), "right not changed after concat b+u");
126 ok(beq($r, "\x{101}"), "left not changed after concat b+u");
130 my $a; ($a .= 5) . 6;
131 ok($a == 5, '($a .= 5) . 6 - present since 5.000');
135 # [perl #24508] optree construction bug
138 $y = ($x = '' . strfoo()) . "y";
139 ok( "$x,$y" eq "x,xy", 'figures out correct target' );
143 # [perl #26905] "use bytes" doesn't apply byte semantics to concatenation
145 my $p = "\xB6"; # PILCROW SIGN (ASCII/EBCDIC), 2bytes in UTF-X
147 my $b = pack 'a*', "\x{100}";
148 my $pu = "\xB6\x{100}";
149 my $up = "\x{100}\xB6";
152 my ($x2, $x3, $x4, $y2);
155 ok(beq($p.$u, $p.$b), "perl #26905, left eq bytes");
156 ok(beq($u.$p, $b.$p), "perl #26905, right eq bytes");
157 ok(!beq($p.$u, $pu), "perl #26905, left ne unicode");
158 ok(!beq($u.$p, $up), "perl #26905, right ne unicode");
165 $x3 = $p; $x3 .= $u . $u;
169 ok(beq($x1, $x2), "perl #26905, left, .= vs = . in bytes");
170 ok(beq($y1, $y2), "perl #26905, right, .= vs = . in bytes");
171 ok(($x1 eq $x2), "perl #26905, left, .= vs = . in chars");
172 ok(($y1 eq $y2), "perl #26905, right, .= vs = . in chars");
173 ok(($x3 eq $x4), "perl #26905, twin, .= vs = . in chars");
177 # Concatenation needs to preserve UTF8ness of left oper.
178 my $x = eval"qr/\x{fff}/";
179 ok( ord chop($x .= "\303\277") == 191, "UTF8ness preserved" );
186 ok($x eq "ab-append-", "Appending to something initialized using constant folding");
195 ok($b eq "aa1", "aa1");
197 ok($b eq "2aa", "2aa");
201 package o { use overload "." => sub { $_[0] }, fallback => 1 }
203 ok(ref(CORE::state $y = "a $o b") eq 'o',
204 'state $y = "foo $bar baz" does not stringify; only concats');
207 # multiconcat: utf8 dest with non-utf8 args should grow dest sufficiently.
208 # This is mainly for valgrind or ASAN to detect problems with.
212 my $t = "\x80" x 1024;
214 ok length($s) == 1027, "utf8 dest with non-utf8 args";
222 ok($a eq 'abcabc', 'append self');
226 ok($a eq 'abcabc', 'double self');
230 ok($a eq 'abcabcabc', 'append double self');
234 ok($a eq 'abc-abc', 'double self with const');
238 ok($a eq 'abcabc-abc', 'append double self with const');
242 ok($a eq 'abcabcabcabc', 'append triple self');
246 ok($a eq 'abc-abc=abc', 'triple self with const');
250 ok($a eq 'abcabc-abc=abc', 'append triple self with const');
253 # test the sorts of optree which may (or may not) get optimised into
254 # a single MULTICONCAT op. It's based on a loop in t/perf/opcount.t,
255 # but here the loop is unwound as we would need to use concat to
256 # generate the expected results to compare with the actual results,
257 # which would rather defeat the object.
260 my ($a1, $a2, $a3) = qw(1 2 3);
269 is("-".$a1, '-1', '"-".$a1');
270 is($a1."-", '1-', '$a1."-"');
271 is("-".$a1."-", '-1-', '"-".$a1."-"');
272 is("$a1", '1', '"$a1"');
273 is("-$a1", '-1', '"-$a1"');
274 is("$a1-", '1-', '"$a1-"');
275 is("-$a1-", '-1-', '"-$a1-"');
276 is($a1.$a2, '12', '$a1.$a2');
277 is($a1."-".$a2, '1-2', '$a1."-".$a2');
278 is("-".$a1."-".$a2, '-1-2', '"-".$a1."-".$a2');
279 is($a1."-".$a2."-", '1-2-', '$a1."-".$a2."-"');
280 is("-".$a1."-".$a2."-", '-1-2-', '"-".$a1."-".$a2."-"');
281 is("$a1$a2", '12', '"$a1$a2"');
282 is("$a1-$a2", '1-2', '"$a1-$a2"');
283 is("-$a1-$a2", '-1-2', '"-$a1-$a2"');
284 is("$a1-$a2-", '1-2-', '"$a1-$a2-"');
285 is("-$a1-$a2-", '-1-2-', '"-$a1-$a2-"');
286 is($a1.$a2.$a3, '123', '$a1.$a2.$a3');
287 is($a1."-".$a2."-".$a3, '1-2-3', '$a1."-".$a2."-".$a3');
288 is("-".$a1."-".$a2."-".$a3, '-1-2-3', '"-".$a1."-".$a2."-".$a3');
289 is($a1."-".$a2."-".$a3."-", '1-2-3-', '$a1."-".$a2."-".$a3."-"');
290 is("-".$a1."-".$a2."-".$a3."-", '-1-2-3-', '"-".$a1."-".$a2."-".$a3."-"');
291 is("$a1$a2$a3", '123', '"$a1$a2$a3"');
292 is("$a1-$a2-$a3", '1-2-3', '"$a1-$a2-$a3"');
293 is("-$a1-$a2-$a3", '-1-2-3', '"-$a1-$a2-$a3"');
294 is("$a1-$a2-$a3-", '1-2-3-', '"$a1-$a2-$a3-"');
295 is("-$a1-$a2-$a3-", '-1-2-3-', '"-$a1-$a2-$a3-"');
297 is($pkg, '-', '$pkg = "-"');
299 is($pkg, '-', '$pkg = "-"');
301 is($pkg, '-', '$pkg = "-"');
303 is($pkg, '-', '$pkg = "-"');
305 is($pkg, '1', '$pkg = $a1');
307 is($pkg, '-1', '$pkg = "-".$a1');
309 is($pkg, '1-', '$pkg = $a1."-"');
311 is($pkg, '-1-', '$pkg = "-".$a1."-"');
313 is($pkg, '1', '$pkg = "$a1"');
315 is($pkg, '-1', '$pkg = "-$a1"');
317 is($pkg, '1-', '$pkg = "$a1-"');
319 is($pkg, '-1-', '$pkg = "-$a1-"');
321 is($pkg, '12', '$pkg = $a1.$a2');
323 is($pkg, '1-2', '$pkg = $a1."-".$a2');
324 $pkg = "-".$a1."-".$a2;
325 is($pkg, '-1-2', '$pkg = "-".$a1."-".$a2');
326 $pkg = $a1."-".$a2."-";
327 is($pkg, '1-2-', '$pkg = $a1."-".$a2."-"');
328 $pkg = "-".$a1."-".$a2."-";
329 is($pkg, '-1-2-', '$pkg = "-".$a1."-".$a2."-"');
331 is($pkg, '12', '$pkg = "$a1$a2"');
333 is($pkg, '1-2', '$pkg = "$a1-$a2"');
335 is($pkg, '-1-2', '$pkg = "-$a1-$a2"');
337 is($pkg, '1-2-', '$pkg = "$a1-$a2-"');
339 is($pkg, '-1-2-', '$pkg = "-$a1-$a2-"');
341 is($pkg, '123', '$pkg = $a1.$a2.$a3');
342 $pkg = $a1."-".$a2."-".$a3;
343 is($pkg, '1-2-3', '$pkg = $a1."-".$a2."-".$a3');
344 $pkg = "-".$a1."-".$a2."-".$a3;
345 is($pkg, '-1-2-3', '$pkg = "-".$a1."-".$a2."-".$a3');
346 $pkg = $a1."-".$a2."-".$a3."-";
347 is($pkg, '1-2-3-', '$pkg = $a1."-".$a2."-".$a3."-"');
348 $pkg = "-".$a1."-".$a2."-".$a3."-";
349 is($pkg, '-1-2-3-', '$pkg = "-".$a1."-".$a2."-".$a3."-"');
351 is($pkg, '123', '$pkg = "$a1$a2$a3"');
352 $pkg = "$a1-$a2-$a3";
353 is($pkg, '1-2-3', '$pkg = "$a1-$a2-$a3"');
354 $pkg = "-$a1-$a2-$a3";
355 is($pkg, '-1-2-3', '$pkg = "-$a1-$a2-$a3"');
356 $pkg = "$a1-$a2-$a3-";
357 is($pkg, '1-2-3-', '$pkg = "$a1-$a2-$a3-"');
358 $pkg = "-$a1-$a2-$a3-";
359 is($pkg, '-1-2-3-', '$pkg = "-$a1-$a2-$a3-"');
362 is($pkg, 'P-', '$pkg .= "-"');
365 is($pkg, 'P-', '$pkg .= "-"');
368 is($pkg, 'P-', '$pkg .= "-"');
371 is($pkg, 'P-', '$pkg .= "-"');
374 is($pkg, 'P1', '$pkg .= $a1');
377 is($pkg, 'P-1', '$pkg .= "-".$a1');
380 is($pkg, 'P1-', '$pkg .= $a1."-"');
383 is($pkg, 'P-1-', '$pkg .= "-".$a1."-"');
386 is($pkg, 'P1', '$pkg .= "$a1"');
389 is($pkg, 'P-1', '$pkg .= "-$a1"');
392 is($pkg, 'P1-', '$pkg .= "$a1-"');
395 is($pkg, 'P-1-', '$pkg .= "-$a1-"');
398 is($pkg, 'P12', '$pkg .= $a1.$a2');
401 is($pkg, 'P1-2', '$pkg .= $a1."-".$a2');
403 $pkg .= "-".$a1."-".$a2;
404 is($pkg, 'P-1-2', '$pkg .= "-".$a1."-".$a2');
406 $pkg .= $a1."-".$a2."-";
407 is($pkg, 'P1-2-', '$pkg .= $a1."-".$a2."-"');
409 $pkg .= "-".$a1."-".$a2."-";
410 is($pkg, 'P-1-2-', '$pkg .= "-".$a1."-".$a2."-"');
413 is($pkg, 'P12', '$pkg .= "$a1$a2"');
416 is($pkg, 'P1-2', '$pkg .= "$a1-$a2"');
419 is($pkg, 'P-1-2', '$pkg .= "-$a1-$a2"');
422 is($pkg, 'P1-2-', '$pkg .= "$a1-$a2-"');
425 is($pkg, 'P-1-2-', '$pkg .= "-$a1-$a2-"');
428 is($pkg, 'P123', '$pkg .= $a1.$a2.$a3');
430 $pkg .= $a1."-".$a2."-".$a3;
431 is($pkg, 'P1-2-3', '$pkg .= $a1."-".$a2."-".$a3');
433 $pkg .= "-".$a1."-".$a2."-".$a3;
434 is($pkg, 'P-1-2-3', '$pkg .= "-".$a1."-".$a2."-".$a3');
436 $pkg .= $a1."-".$a2."-".$a3."-";
437 is($pkg, 'P1-2-3-', '$pkg .= $a1."-".$a2."-".$a3."-"');
439 $pkg .= "-".$a1."-".$a2."-".$a3."-";
440 is($pkg, 'P-1-2-3-', '$pkg .= "-".$a1."-".$a2."-".$a3."-"');
443 is($pkg, 'P123', '$pkg .= "$a1$a2$a3"');
445 $pkg .= "$a1-$a2-$a3";
446 is($pkg, 'P1-2-3', '$pkg .= "$a1-$a2-$a3"');
448 $pkg .= "-$a1-$a2-$a3";
449 is($pkg, 'P-1-2-3', '$pkg .= "-$a1-$a2-$a3"');
451 $pkg .= "$a1-$a2-$a3-";
452 is($pkg, 'P1-2-3-', '$pkg .= "$a1-$a2-$a3-"');
454 $pkg .= "-$a1-$a2-$a3-";
455 is($pkg, 'P-1-2-3-', '$pkg .= "-$a1-$a2-$a3-"');
457 is($lex, '-', '$lex = "-"');
459 is($lex, '-', '$lex = "-"');
461 is($lex, '-', '$lex = "-"');
463 is($lex, '-', '$lex = "-"');
465 is($lex, '1', '$lex = $a1');
467 is($lex, '-1', '$lex = "-".$a1');
469 is($lex, '1-', '$lex = $a1."-"');
471 is($lex, '-1-', '$lex = "-".$a1."-"');
473 is($lex, '1', '$lex = "$a1"');
475 is($lex, '-1', '$lex = "-$a1"');
477 is($lex, '1-', '$lex = "$a1-"');
479 is($lex, '-1-', '$lex = "-$a1-"');
481 is($lex, '12', '$lex = $a1.$a2');
483 is($lex, '1-2', '$lex = $a1."-".$a2');
484 $lex = "-".$a1."-".$a2;
485 is($lex, '-1-2', '$lex = "-".$a1."-".$a2');
486 $lex = $a1."-".$a2."-";
487 is($lex, '1-2-', '$lex = $a1."-".$a2."-"');
488 $lex = "-".$a1."-".$a2."-";
489 is($lex, '-1-2-', '$lex = "-".$a1."-".$a2."-"');
491 is($lex, '12', '$lex = "$a1$a2"');
493 is($lex, '1-2', '$lex = "$a1-$a2"');
495 is($lex, '-1-2', '$lex = "-$a1-$a2"');
497 is($lex, '1-2-', '$lex = "$a1-$a2-"');
499 is($lex, '-1-2-', '$lex = "-$a1-$a2-"');
501 is($lex, '123', '$lex = $a1.$a2.$a3');
502 $lex = $a1."-".$a2."-".$a3;
503 is($lex, '1-2-3', '$lex = $a1."-".$a2."-".$a3');
504 $lex = "-".$a1."-".$a2."-".$a3;
505 is($lex, '-1-2-3', '$lex = "-".$a1."-".$a2."-".$a3');
506 $lex = $a1."-".$a2."-".$a3."-";
507 is($lex, '1-2-3-', '$lex = $a1."-".$a2."-".$a3."-"');
508 $lex = "-".$a1."-".$a2."-".$a3."-";
509 is($lex, '-1-2-3-', '$lex = "-".$a1."-".$a2."-".$a3."-"');
511 is($lex, '123', '$lex = "$a1$a2$a3"');
512 $lex = "$a1-$a2-$a3";
513 is($lex, '1-2-3', '$lex = "$a1-$a2-$a3"');
514 $lex = "-$a1-$a2-$a3";
515 is($lex, '-1-2-3', '$lex = "-$a1-$a2-$a3"');
516 $lex = "$a1-$a2-$a3-";
517 is($lex, '1-2-3-', '$lex = "$a1-$a2-$a3-"');
518 $lex = "-$a1-$a2-$a3-";
519 is($lex, '-1-2-3-', '$lex = "-$a1-$a2-$a3-"');
522 is($lex, 'L-', '$lex .= "-"');
525 is($lex, 'L-', '$lex .= "-"');
528 is($lex, 'L-', '$lex .= "-"');
531 is($lex, 'L-', '$lex .= "-"');
534 is($lex, 'L1', '$lex .= $a1');
537 is($lex, 'L-1', '$lex .= "-".$a1');
540 is($lex, 'L1-', '$lex .= $a1."-"');
543 is($lex, 'L-1-', '$lex .= "-".$a1."-"');
546 is($lex, 'L1', '$lex .= "$a1"');
549 is($lex, 'L-1', '$lex .= "-$a1"');
552 is($lex, 'L1-', '$lex .= "$a1-"');
555 is($lex, 'L-1-', '$lex .= "-$a1-"');
558 is($lex, 'L12', '$lex .= $a1.$a2');
561 is($lex, 'L1-2', '$lex .= $a1."-".$a2');
563 $lex .= "-".$a1."-".$a2;
564 is($lex, 'L-1-2', '$lex .= "-".$a1."-".$a2');
566 $lex .= $a1."-".$a2."-";
567 is($lex, 'L1-2-', '$lex .= $a1."-".$a2."-"');
569 $lex .= "-".$a1."-".$a2."-";
570 is($lex, 'L-1-2-', '$lex .= "-".$a1."-".$a2."-"');
573 is($lex, 'L12', '$lex .= "$a1$a2"');
576 is($lex, 'L1-2', '$lex .= "$a1-$a2"');
579 is($lex, 'L-1-2', '$lex .= "-$a1-$a2"');
582 is($lex, 'L1-2-', '$lex .= "$a1-$a2-"');
585 is($lex, 'L-1-2-', '$lex .= "-$a1-$a2-"');
588 is($lex, 'L123', '$lex .= $a1.$a2.$a3');
590 $lex .= $a1."-".$a2."-".$a3;
591 is($lex, 'L1-2-3', '$lex .= $a1."-".$a2."-".$a3');
593 $lex .= "-".$a1."-".$a2."-".$a3;
594 is($lex, 'L-1-2-3', '$lex .= "-".$a1."-".$a2."-".$a3');
596 $lex .= $a1."-".$a2."-".$a3."-";
597 is($lex, 'L1-2-3-', '$lex .= $a1."-".$a2."-".$a3."-"');
599 $lex .= "-".$a1."-".$a2."-".$a3."-";
600 is($lex, 'L-1-2-3-', '$lex .= "-".$a1."-".$a2."-".$a3."-"');
603 is($lex, 'L123', '$lex .= "$a1$a2$a3"');
605 $lex .= "$a1-$a2-$a3";
606 is($lex, 'L1-2-3', '$lex .= "$a1-$a2-$a3"');
608 $lex .= "-$a1-$a2-$a3";
609 is($lex, 'L-1-2-3', '$lex .= "-$a1-$a2-$a3"');
611 $lex .= "$a1-$a2-$a3-";
612 is($lex, 'L1-2-3-', '$lex .= "$a1-$a2-$a3-"');
614 $lex .= "-$a1-$a2-$a3-";
615 is($lex, 'L-1-2-3-', '$lex .= "-$a1-$a2-$a3-"');
618 is($l, '-', 'my $l = "-"');
622 is($l, '-', 'my $l = "-"');
626 is($l, '-', 'my $l = "-"');
630 is($l, '-', 'my $l = "-"');
634 is($l, '1', 'my $l = $a1');
638 is($l, '-1', 'my $l = "-".$a1');
642 is($l, '1-', 'my $l = $a1."-"');
646 is($l, '-1-', 'my $l = "-".$a1."-"');
650 is($l, '1', 'my $l = "$a1"');
654 is($l, '-1', 'my $l = "-$a1"');
658 is($l, '1-', 'my $l = "$a1-"');
662 is($l, '-1-', 'my $l = "-$a1-"');
666 is($l, '12', 'my $l = $a1.$a2');
670 is($l, '1-2', 'my $l = $a1."-".$a2');
673 my $l = "-".$a1."-".$a2;
674 is($l, '-1-2', 'my $l = "-".$a1."-".$a2');
677 my $l = $a1."-".$a2."-";
678 is($l, '1-2-', 'my $l = $a1."-".$a2."-"');
681 my $l = "-".$a1."-".$a2."-";
682 is($l, '-1-2-', 'my $l = "-".$a1."-".$a2."-"');
686 is($l, '12', 'my $l = "$a1$a2"');
690 is($l, '1-2', 'my $l = "$a1-$a2"');
694 is($l, '-1-2', 'my $l = "-$a1-$a2"');
698 is($l, '1-2-', 'my $l = "$a1-$a2-"');
702 is($l, '-1-2-', 'my $l = "-$a1-$a2-"');
706 is($l, '123', 'my $l = $a1.$a2.$a3');
709 my $l = $a1."-".$a2."-".$a3;
710 is($l, '1-2-3', 'my $l = $a1."-".$a2."-".$a3');
713 my $l = "-".$a1."-".$a2."-".$a3;
714 is($l, '-1-2-3', 'my $l = "-".$a1."-".$a2."-".$a3');
717 my $l = $a1."-".$a2."-".$a3."-";
718 is($l, '1-2-3-', 'my $l = $a1."-".$a2."-".$a3."-"');
721 my $l = "-".$a1."-".$a2."-".$a3."-";
722 is($l, '-1-2-3-', 'my $l = "-".$a1."-".$a2."-".$a3."-"');
726 is($l, '123', 'my $l = "$a1$a2$a3"');
729 my $l = "$a1-$a2-$a3";
730 is($l, '1-2-3', 'my $l = "$a1-$a2-$a3"');
733 my $l = "-$a1-$a2-$a3";
734 is($l, '-1-2-3', 'my $l = "-$a1-$a2-$a3"');
737 my $l = "$a1-$a2-$a3-";
738 is($l, '1-2-3-', 'my $l = "$a1-$a2-$a3-"');
741 my $l = "-$a1-$a2-$a3-";
742 is($l, '-1-2-3-', 'my $l = "-$a1-$a2-$a3-"');
746 # multiconcat optimises away scalar assign, and is responsible
747 # for handling the assign itself. If the LHS is something weird,
748 # make sure it's handled ok
757 is($$re, "ab", '$$re = $a . $b');
759 #passing a hash elem to a sub creates a PVLV
760 my $s = sub { $_[0] = $a . $b; };
763 is($h{foo}, "ab", "PVLV");
765 # assigning a string to a typeglob creates an alias
767 *Bar = ("F" . $o . $o);
768 is($Bar, "myfoo", '*Bar = "Foo"');
770 # while that same typeglob also appearing on the RHS returns
771 # a stringified value
774 ${'*QPR::Bar*QPR::BarBaz'} = 'myfoobarbaz';
775 *Bar = (*Bar . *Bar . "Baz");
776 ::is($Bar, "myfoobarbaz", '*Bar = (*Bar . *Bar . "Baz")');
780 # distinguish between '=' and '.=' where the LHS has the OPf_MOD flag
784 my $a . $foo; # weird but legal
785 is($a, '', 'my $a . $foo');
787 is($b, 'foo', 'my $b; $b .= $foo');
790 # distinguish between nested appends and concats; the former is
791 # affected by the change of value of the target on each concat.
792 # This is why multiconcat shouldn't be used in that case
796 (($a .= $a) .= $a) .= $a;
797 is($a, "aaaaaaaa", '(($a .= $a) .= $a) .= $a;');
800 # check everything works ok near the max arg size of a multiconcat
803 my @a = map "<$_>", 0..99;
804 for my $i (60..68) { # check each side of 64 threshold
805 my $c = join '.', map "\$a[$_]", 0..$i;
806 my $got = eval $c or die $@;
807 my $empty = ''; # don't use a const string in case join'' ever
808 # gets optimised into a multiconcat
809 my $expected = join $empty, @a[0..$i];
810 is($got, $expected, "long concat chain $i");