|
6 | 6 | set_up_inc('../lib');
|
7 | 7 | }
|
8 | 8 |
|
9 |
| -plan tests => 41; |
| 9 | +plan tests => 43; |
10 | 10 |
|
11 | 11 | @x = (1, 2, 3);
|
12 | 12 | is( join(':',@x), '1:2:3', 'join an array with character');
|
@@ -179,3 +179,37 @@ isnt $_[1], $_[0],
|
179 | 179 | }
|
180 | 180 | is( $SM::fetched, 3, 'FETCH called 1 + 2 times' );
|
181 | 181 | }
|
| 182 | +{ |
| 183 | + # see GH #21484 |
| 184 | + local $TODO = "changes to delim have an effect"; |
| 185 | + my $expect = "a\x{100}x\x{100}b\n"; |
| 186 | + utf8::encode($expect); |
| 187 | + fresh_perl_is(<<'CODE', $expect, {}, "modifications delim from magic should be ignored"); |
| 188 | +my $n = 1; |
| 189 | +my $sep = "\x{100}" x $n; |
| 190 | +package MyOver { |
| 191 | + use overload '""' => sub { $sep = "\xFF" x $n; "x" }; |
| 192 | +} |
| 193 | +
|
| 194 | +my $x = bless {}, "MyOver"; |
| 195 | +binmode STDOUT, ":utf8"; |
| 196 | +print join($sep, "a", $x, "b"), "\n"; |
| 197 | +CODE |
| 198 | +} |
| 199 | +{ |
| 200 | + # see GH #21484 |
| 201 | + my $expect = "x\x{100}a\n"; |
| 202 | + local $TODO = "modifications to delim PVX caused UB"; |
| 203 | + utf8::encode($expect); # fresh_perl() does bytes |
| 204 | + fresh_perl_is(<<'CODE', $expect, {}, "modifications to delim PVX shouldn't crash"); |
| 205 | +my $n = 1; |
| 206 | +my $sep = "\x{100}" x $n; |
| 207 | +package MyOver { |
| 208 | + use overload '""' => sub { $sep = "\xFF" x ($n+20); "x" }; |
| 209 | +} |
| 210 | +
|
| 211 | +my $x = bless {}, "MyOver"; |
| 212 | +binmode STDOUT, ":utf8"; |
| 213 | +print join($sep, $x, "a"), "\n"; |
| 214 | +CODE |
| 215 | +} |
0 commit comments