|
3 | 3 | # Checks if the parser behaves correctly in edge cases
|
4 | 4 | # (including weird syntax errors)
|
5 | 5 |
|
6 |
| -print "1..104\n"; |
| 6 | +print "1..117\n"; |
7 | 7 |
|
8 | 8 | sub failed {
|
9 | 9 | my ($got, $expected, $name) = @_;
|
@@ -285,6 +285,54 @@ like($@, qr/BEGIN failed--compilation aborted/, 'BEGIN 6' );
|
285 | 285 | eval q[ BEGIN {\&foo4; die } ] for 1..10;
|
286 | 286 | like($@, qr/BEGIN failed--compilation aborted/, 'BEGIN 7' );
|
287 | 287 |
|
| 288 | +{ |
| 289 | + # RT #70934 |
| 290 | + # check both the specific case in the ticket, and a few other paths into |
| 291 | + # S_scan_ident() |
| 292 | + # simplify long ids |
| 293 | + my $x100 = "x" x 256; |
| 294 | + my $xFE = "x" x 254; |
| 295 | + my $xFD = "x" x 253; |
| 296 | + my $xFC = "x" x 252; |
| 297 | + my $xFB = "x" x 251; |
| 298 | + |
| 299 | + eval qq[ \$#$xFB ]; |
| 300 | + is($@, "", "251 character \$# sigil ident ok"); |
| 301 | + eval qq[ \$#$xFC ]; |
| 302 | + like($@, qr/Identifier too long/, "too long id in \$# sigil ctx"); |
| 303 | + |
| 304 | + eval qq[ \$$xFB ]; |
| 305 | + is($@, "", "251 character \$ sigil ident ok"); |
| 306 | + eval qq[ \$$xFC ]; |
| 307 | + like($@, qr/Identifier too long/, "too long id in \$ sigil ctx"); |
| 308 | + |
| 309 | + eval qq[ %$xFB ]; |
| 310 | + is($@, "", "251 character % sigil ident ok"); |
| 311 | + eval qq[ %$xFC ]; |
| 312 | + like($@, qr/Identifier too long/, "too long id in % sigil ctx"); |
| 313 | + |
| 314 | + eval qq[ \\&$xFC ]; # take a ref since I don't want to call it |
| 315 | + is($@, "", "252 character & sigil ident ok"); |
| 316 | + eval qq[ \\&$xFD ]; |
| 317 | + like($@, qr/Identifier too long/, "too long id in & sigil ctx"); |
| 318 | + |
| 319 | + eval qq[ *$xFC ]; |
| 320 | + is($@, "", "252 character glob ident ok"); |
| 321 | + eval qq[ *$xFD ]; |
| 322 | + like($@, qr/Identifier too long/, "too long id in glob ctx"); |
| 323 | + |
| 324 | + eval qq[ for $xFD ]; |
| 325 | + like($@, qr/Missing \$ on loop variable/, |
| 326 | + "253 char id ok, but a different error"); |
| 327 | + eval qq[ for $xFE; ]; |
| 328 | + like($@, qr/Identifier too long/, "too long id in for ctx"); |
| 329 | + |
| 330 | + # the specific case from the ticket |
| 331 | + my $x = "x" x 257; |
| 332 | + eval qq[ for $x ]; |
| 333 | + like($@, qr/Identifier too long/, "too long id ticket case"); |
| 334 | +} |
| 335 | + |
288 | 336 | # Add new tests HERE:
|
289 | 337 |
|
290 | 338 | # More awkward tests for #line. Keep these at the end, as they will screw
|
|
0 commit comments