| 1 | use v6; |
|---|
| 2 | |
|---|
| 3 | use Test; |
|---|
| 4 | |
|---|
| 5 | plan 11; |
|---|
| 6 | |
|---|
| 7 | =begin kwid |
|---|
| 8 | |
|---|
| 9 | Basic tests for #line |
|---|
| 10 | |
|---|
| 11 | =end kwid |
|---|
| 12 | |
|---|
| 13 | my $file = $?FILE; |
|---|
| 14 | |
|---|
| 15 | is($?POSITION, "$file line 15, column 4-14", 'plain old $?POSITION'); |
|---|
| 16 | |
|---|
| 17 | my $dummy = 0; # This comment is not column1 |
|---|
| 18 | $dummy = 1; # And neither is this one. |
|---|
| 19 | |
|---|
| 20 | is($?POSITION, "$file line 20, column 4-14", "plain comments don't disrupt position"); |
|---|
| 21 | |
|---|
| 22 | # This comment does start column1 |
|---|
| 23 | |
|---|
| 24 | is($?POSITION, "$file line 24, column 4-14", "comments column1 don't disrupt position"); |
|---|
| 25 | |
|---|
| 26 | #line 1024 |
|---|
| 27 | is($?POSITION, "$file line 1024, column 4-14", "basic #line works"); |
|---|
| 28 | |
|---|
| 29 | #line1 |
|---|
| 30 | is($?POSITION, "$file line 1027, column 4-14", "#line1 (no whitespace) is ignored"); |
|---|
| 31 | |
|---|
| 32 | #line1 1 |
|---|
| 33 | is($?POSITION, "$file line 1030, column 4-14", "#line1 1 is ignored"); |
|---|
| 34 | |
|---|
| 35 | #line 2048 "oneword" |
|---|
| 36 | is($?POSITION, "oneword line 2048, column 4-14", '#line n "filename"'); |
|---|
| 37 | |
|---|
| 38 | #line 4096 two words |
|---|
| 39 | is($?POSITION, "oneword line 2051, column 4-14", '#line n two words ignored (should be quoted)'); |
|---|
| 40 | |
|---|
| 41 | #line 8192 unquoted |
|---|
| 42 | is($?POSITION, "unquoted line 8192, column 4-14", '#line n unquoted (one word is ok)'); |
|---|
| 43 | |
|---|
| 44 | #line 16384 123 |
|---|
| 45 | is($?POSITION, "123 line 16384, column 4-14", '#line n unquoted-n (word can be number, too)'); |
|---|
| 46 | |
|---|
| 47 | #line 32768 "now is the time" |
|---|
| 48 | is($?POSITION, "now is the time line 32768, column 4-14", '#line n "long quoted name"'); |
|---|