Adding the failure diagnostic
[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 {
bdaa056b 31 print "not " unless $_ eq "$dx$dx";
32 print "ok $test\n";
33 $test++;
34 }
35
36 $_ = $dx = "\x{10f2}";
37 s/($dx)/$1$dx/;
38 {
bdaa056b 39 print "not " unless $_ eq "$dx$dx";
40 print "ok $test\n";
41 $test++;
42 }
43
44 $dx = "\x{10f2}";
45 $_ = "\x{10f2}\x{10f2}";
46 s/($dx)($dx)/$1$2/;
47 {
bdaa056b 48 print "not " unless $_ eq "$dx$dx";
49 print "ok $test\n";
50 $test++;
51 }
52}
53
54{
55 # bug id 20000901.092
56 # test that undef left and right of utf8 results in a valid string
57
58 my $a;
59 $a .= "\x{1ff}";
60 print "not " unless $a eq "\x{1ff}";
61 print "ok $test\n";
62 $test++;
63}
64
65{
66 # ID 20001020.006
67
68 "x" =~ /(.)/; # unset $2
69
70 # Without the fix this 5.7.0 would croak:
71 # Modification of a read-only value attempted at ...
72 "$2\x{1234}";
73
74 print "ok $test\n";
75 $test++;
76
77 # For symmetry with the above.
78 "\x{1234}$2";
79
80 print "ok $test\n";
81 $test++;
82
83 *pi = \undef;
84 # This bug existed earlier than the $2 bug, but is fixed with the same
85 # patch. Without the fix this 5.7.0 would also croak:
86 # Modification of a read-only value attempted at ...
87 "$pi\x{1234}";
88
89 print "ok $test\n";
90 $test++;
91
92 # For symmetry with the above.
93 "\x{1234}$pi";
94
95 print "ok $test\n";
96 $test++;
97}