Integrate mainline.
[p5sagit/p5-mst-13.2.git] / t / op / concat.t
CommitLineData
bdaa056b 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8print "1..11\n";
9
10($a, $b, $c) = qw(foo bar);
11
12print "not " unless "$a" eq "foo";
13print "ok 1\n";
14
15print "not " unless "$a$b" eq "foobar";
16print "ok 2\n";
17
18print "not " unless "$c$a$c" eq "foo";
19print "ok 3\n";
20
21# Okay, so that wasn't very challenging. Let's go Unicode.
22
23my $test = 4;
24
25{
26 # bug id 20000819.004
27
28 $_ = $dx = "\x{10f2}";
29 s/($dx)/$dx$1/;
30 {
31 use bytes;
32 print "not " unless $_ eq "$dx$dx";
33 print "ok $test\n";
34 $test++;
35 }
36
37 $_ = $dx = "\x{10f2}";
38 s/($dx)/$1$dx/;
39 {
40 use bytes;
41 print "not " unless $_ eq "$dx$dx";
42 print "ok $test\n";
43 $test++;
44 }
45
46 $dx = "\x{10f2}";
47 $_ = "\x{10f2}\x{10f2}";
48 s/($dx)($dx)/$1$2/;
49 {
50 use bytes;
51 print "not " unless $_ eq "$dx$dx";
52 print "ok $test\n";
53 $test++;
54 }
55}
56
57{
58 # bug id 20000901.092
59 # test that undef left and right of utf8 results in a valid string
60
61 my $a;
62 $a .= "\x{1ff}";
63 print "not " unless $a eq "\x{1ff}";
64 print "ok $test\n";
65 $test++;
66}
67
68{
69 # ID 20001020.006
70
71 "x" =~ /(.)/; # unset $2
72
73 # Without the fix this 5.7.0 would croak:
74 # Modification of a read-only value attempted at ...
75 "$2\x{1234}";
76
77 print "ok $test\n";
78 $test++;
79
80 # For symmetry with the above.
81 "\x{1234}$2";
82
83 print "ok $test\n";
84 $test++;
85
86 *pi = \undef;
87 # This bug existed earlier than the $2 bug, but is fixed with the same
88 # patch. Without the fix this 5.7.0 would also croak:
89 # Modification of a read-only value attempted at ...
90 "$pi\x{1234}";
91
92 print "ok $test\n";
93 $test++;
94
95 # For symmetry with the above.
96 "\x{1234}$pi";
97
98 print "ok $test\n";
99 $test++;
100}