Commit | Line | Data |
bc9b29db |
1 | Check the lexical scoping of the err keyword. |
2 | (The actual behaviour is tested in t/op/dor.t) |
3 | |
4 | __END__ |
5 | # No err; should be a syntax error. |
6 | use warnings; |
7 | my $undef err print "Hello!\n"; |
8 | EXPECT |
9 | Bareword found where operator expected at - line 3, near "$undef err" |
10 | (Missing operator before err?) |
11 | Unquoted string "err" may clash with future reserved word at - line 3. |
12 | syntax error at - line 3, near "$undef err " |
13 | Execution of - aborted due to compilation errors. |
14 | ######## |
15 | # With err, should work |
16 | use warnings; |
17 | use feature "err"; |
18 | my $undef err print "Hello", "world"; |
19 | EXPECT |
20 | Helloworld |
21 | ######## |
22 | # With err, should work in eval too |
23 | use warnings; |
24 | use feature "err"; |
25 | eval q(my $undef err print "Hello", "world"); |
26 | EXPECT |
27 | Helloworld |
28 | ######## |
29 | # feature out of scope; should be a syntax error. |
30 | use warnings; |
31 | { use feature 'err'; } |
32 | my $undef err print "Hello", "world"; |
33 | EXPECT |
34 | Bareword found where operator expected at - line 4, near "$undef err" |
35 | (Missing operator before err?) |
36 | Unquoted string "err" may clash with future reserved word at - line 4. |
37 | syntax error at - line 4, near "$undef err " |
38 | Execution of - aborted due to compilation errors. |
39 | ######## |
40 | # 'no feature' should work |
41 | use warnings; |
42 | use feature 'err'; |
43 | my $undef err print "Hello", "world"; |
44 | no feature; |
45 | my $undef2 err "Hello", "world"; |
46 | EXPECT |
47 | Bareword found where operator expected at - line 6, near "$undef2 err" |
48 | (Missing operator before err?) |
49 | Unquoted string "err" may clash with future reserved word at - line 6. |
50 | String found where operator expected at - line 6, near "err "Hello"" |
51 | (Do you need to predeclare err?) |
52 | syntax error at - line 6, near "$undef2 err " |
53 | Execution of - aborted due to compilation errors. |
54 | ######## |
55 | # 'no feature "err"' should work too |
56 | use warnings; |
57 | use feature 'err'; |
58 | my $undef err print "Hello", "world"; |
59 | no feature 'err'; |
60 | $undef err print "Hello", "world"; |
61 | EXPECT |
62 | Bareword found where operator expected at - line 6, near "$undef err" |
63 | (Missing operator before err?) |
64 | Unquoted string "err" may clash with future reserved word at - line 6. |
65 | syntax error at - line 6, near "$undef err " |
66 | Execution of - aborted due to compilation errors. |