Commit | Line | Data |
0d863452 |
1 | Check the lexical scoping of the switch keywords. |
2 | (The actual behaviour is tested in t/op/smartmatch.t) |
3 | |
4 | __END__ |
5 | # No ~~; should be a syntax error. |
6 | use warnings; |
7 | print +(2 ~~ 2); |
8 | EXPECT |
9 | syntax error at - line 3, near "2 ~" |
10 | Execution of - aborted due to compilation errors. |
11 | ######## |
12 | # With ~~, should work |
13 | use warnings; |
14 | use feature "~~"; |
15 | print +(2 ~~ 2); |
16 | EXPECT |
17 | 1 |
18 | ######## |
19 | # ~~ out of scope; should be a syntax error. |
20 | use warnings; |
21 | { use feature '~~'; } |
22 | print +(2 ~~ 2); |
23 | EXPECT |
24 | syntax error at - line 4, near "2 ~" |
25 | Execution of - aborted due to compilation errors. |
26 | ######## |
27 | # 'no feature' should work |
28 | use warnings; |
29 | use feature '~~'; |
30 | print +(2 ~~ 2), "\n"; |
31 | no feature; |
32 | print +(2 ~~ 2), "\n"; |
33 | EXPECT |
34 | syntax error at - line 6, near "2 ~" |
35 | Execution of - aborted due to compilation errors. |
36 | ######## |
37 | # 'no feature "~~"' should work too |
38 | use warnings; |
39 | use feature '~~'; |
40 | print +(2 ~~ 2), "\n"; |
41 | no feature "~~"; |
42 | print +(2 ~~ 2), "\n"; |
43 | EXPECT |
44 | syntax error at - line 6, near "2 ~" |
45 | Execution of - aborted due to compilation errors. |