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