Commit | Line | Data |
---|---|---|
4438c4b7 | 1 | Check lexical warnings functionality |
599cee73 | 2 | |
3 | TODO | |
4 | check that the warning hierarchy works. | |
5 | ||
6 | __END__ | |
7 | ||
8 | # check illegal category is caught | |
4438c4b7 | 9 | use warnings 'blah' ; |
599cee73 | 10 | EXPECT |
11 | unknown warning category 'blah' at - line 3 | |
12 | BEGIN failed--compilation aborted at - line 3. | |
13 | ######## | |
14 | ||
15 | # Check compile time scope of pragma | |
4438c4b7 | 16 | use warnings 'deprecated' ; |
599cee73 | 17 | { |
4438c4b7 | 18 | no warnings ; |
599cee73 | 19 | 1 if $a EQ $b ; |
20 | } | |
21 | 1 if $a EQ $b ; | |
22 | EXPECT | |
23 | Use of EQ is deprecated at - line 8. | |
24 | ######## | |
25 | ||
26 | # Check compile time scope of pragma | |
4438c4b7 | 27 | no warnings; |
599cee73 | 28 | { |
4438c4b7 | 29 | use warnings 'deprecated' ; |
599cee73 | 30 | 1 if $a EQ $b ; |
31 | } | |
32 | 1 if $a EQ $b ; | |
33 | EXPECT | |
34 | Use of EQ is deprecated at - line 6. | |
35 | ######## | |
36 | ||
37 | # Check runtime scope of pragma | |
4438c4b7 | 38 | use warnings 'uninitialized' ; |
599cee73 | 39 | { |
4438c4b7 | 40 | no warnings ; |
599cee73 | 41 | my $b ; chop $b ; |
42 | } | |
43 | my $b ; chop $b ; | |
44 | EXPECT | |
b89fed5f | 45 | Use of uninitialized value in scalar chop at - line 8. |
599cee73 | 46 | ######## |
47 | ||
48 | # Check runtime scope of pragma | |
4438c4b7 | 49 | no warnings ; |
599cee73 | 50 | { |
4438c4b7 | 51 | use warnings 'uninitialized' ; |
599cee73 | 52 | my $b ; chop $b ; |
53 | } | |
54 | my $b ; chop $b ; | |
55 | EXPECT | |
b89fed5f | 56 | Use of uninitialized value in scalar chop at - line 6. |
599cee73 | 57 | ######## |
58 | ||
59 | # Check runtime scope of pragma | |
4438c4b7 | 60 | no warnings ; |
599cee73 | 61 | { |
4438c4b7 | 62 | use warnings 'uninitialized' ; |
599cee73 | 63 | $a = sub { my $b ; chop $b ; } |
64 | } | |
65 | &$a ; | |
66 | EXPECT | |
b89fed5f | 67 | Use of uninitialized value in scalar chop at - line 6. |
599cee73 | 68 | ######## |
69 | ||
4438c4b7 | 70 | use warnings 'deprecated' ; |
599cee73 | 71 | 1 if $a EQ $b ; |
72 | EXPECT | |
73 | Use of EQ is deprecated at - line 3. | |
74 | ######## | |
75 | ||
76 | --FILE-- abc | |
77 | 1 if $a EQ $b ; | |
78 | 1; | |
79 | --FILE-- | |
4438c4b7 | 80 | use warnings 'deprecated' ; |
599cee73 | 81 | require "./abc"; |
82 | EXPECT | |
83 | ||
84 | ######## | |
85 | ||
86 | --FILE-- abc | |
4438c4b7 | 87 | use warnings 'deprecated' ; |
599cee73 | 88 | 1; |
89 | --FILE-- | |
90 | require "./abc"; | |
91 | 1 if $a EQ $b ; | |
92 | EXPECT | |
93 | ||
94 | ######## | |
95 | ||
96 | --FILE-- abc | |
4438c4b7 | 97 | use warnings 'deprecated' ; |
599cee73 | 98 | 1 if $a EQ $b ; |
99 | 1; | |
100 | --FILE-- | |
4438c4b7 | 101 | use warnings 'uninitialized' ; |
599cee73 | 102 | require "./abc"; |
103 | my $a ; chop $a ; | |
104 | EXPECT | |
105 | Use of EQ is deprecated at ./abc line 2. | |
b89fed5f | 106 | Use of uninitialized value in scalar chop at - line 3. |
599cee73 | 107 | ######## |
108 | ||
109 | --FILE-- abc.pm | |
4438c4b7 | 110 | use warnings 'deprecated' ; |
599cee73 | 111 | 1 if $a EQ $b ; |
112 | 1; | |
113 | --FILE-- | |
4438c4b7 | 114 | use warnings 'uninitialized' ; |
599cee73 | 115 | use abc; |
116 | my $a ; chop $a ; | |
117 | EXPECT | |
118 | Use of EQ is deprecated at abc.pm line 2. | |
b89fed5f | 119 | Use of uninitialized value in scalar chop at - line 3. |
599cee73 | 120 | ######## |
121 | ||
122 | # Check scope of pragma with eval | |
4438c4b7 | 123 | no warnings ; |
599cee73 | 124 | eval { |
125 | my $b ; chop $b ; | |
126 | }; print STDERR $@ ; | |
127 | my $b ; chop $b ; | |
128 | EXPECT | |
129 | ||
130 | ######## | |
131 | ||
132 | # Check scope of pragma with eval | |
4438c4b7 | 133 | no warnings ; |
599cee73 | 134 | eval { |
4438c4b7 | 135 | use warnings 'uninitialized' ; |
599cee73 | 136 | my $b ; chop $b ; |
137 | }; print STDERR $@ ; | |
138 | my $b ; chop $b ; | |
139 | EXPECT | |
b89fed5f | 140 | Use of uninitialized value in scalar chop at - line 6. |
599cee73 | 141 | ######## |
142 | ||
143 | # Check scope of pragma with eval | |
4438c4b7 | 144 | use warnings 'uninitialized' ; |
599cee73 | 145 | eval { |
146 | my $b ; chop $b ; | |
147 | }; print STDERR $@ ; | |
148 | my $b ; chop $b ; | |
149 | EXPECT | |
b89fed5f | 150 | Use of uninitialized value in scalar chop at - line 5. |
151 | Use of uninitialized value in scalar chop at - line 7. | |
599cee73 | 152 | ######## |
153 | ||
154 | # Check scope of pragma with eval | |
4438c4b7 | 155 | use warnings 'uninitialized' ; |
599cee73 | 156 | eval { |
4438c4b7 | 157 | no warnings ; |
599cee73 | 158 | my $b ; chop $b ; |
159 | }; print STDERR $@ ; | |
160 | my $b ; chop $b ; | |
161 | EXPECT | |
b89fed5f | 162 | Use of uninitialized value in scalar chop at - line 8. |
599cee73 | 163 | ######## |
164 | ||
165 | # Check scope of pragma with eval | |
4438c4b7 | 166 | no warnings ; |
599cee73 | 167 | eval { |
168 | 1 if $a EQ $b ; | |
169 | }; print STDERR $@ ; | |
170 | 1 if $a EQ $b ; | |
171 | EXPECT | |
172 | ||
173 | ######## | |
174 | ||
175 | # Check scope of pragma with eval | |
4438c4b7 | 176 | no warnings ; |
599cee73 | 177 | eval { |
4438c4b7 | 178 | use warnings 'deprecated' ; |
599cee73 | 179 | 1 if $a EQ $b ; |
180 | }; print STDERR $@ ; | |
181 | 1 if $a EQ $b ; | |
182 | EXPECT | |
183 | Use of EQ is deprecated at - line 6. | |
184 | ######## | |
185 | ||
186 | # Check scope of pragma with eval | |
4438c4b7 | 187 | use warnings 'deprecated' ; |
599cee73 | 188 | eval { |
189 | 1 if $a EQ $b ; | |
190 | }; print STDERR $@ ; | |
191 | 1 if $a EQ $b ; | |
192 | EXPECT | |
193 | Use of EQ is deprecated at - line 5. | |
194 | Use of EQ is deprecated at - line 7. | |
195 | ######## | |
196 | ||
197 | # Check scope of pragma with eval | |
4438c4b7 | 198 | use warnings 'deprecated' ; |
599cee73 | 199 | eval { |
4438c4b7 | 200 | no warnings ; |
599cee73 | 201 | 1 if $a EQ $b ; |
202 | }; print STDERR $@ ; | |
203 | 1 if $a EQ $b ; | |
204 | EXPECT | |
205 | Use of EQ is deprecated at - line 8. | |
206 | ######## | |
207 | ||
208 | # Check scope of pragma with eval | |
4438c4b7 | 209 | no warnings ; |
599cee73 | 210 | eval ' |
211 | my $b ; chop $b ; | |
212 | '; print STDERR $@ ; | |
213 | my $b ; chop $b ; | |
214 | EXPECT | |
215 | ||
216 | ######## | |
217 | ||
218 | # Check scope of pragma with eval | |
4438c4b7 | 219 | no warnings ; |
599cee73 | 220 | eval q[ |
4438c4b7 | 221 | use warnings 'uninitialized' ; |
599cee73 | 222 | my $b ; chop $b ; |
223 | ]; print STDERR $@; | |
224 | my $b ; chop $b ; | |
225 | EXPECT | |
b89fed5f | 226 | Use of uninitialized value in scalar chop at (eval 1) line 3. |
599cee73 | 227 | ######## |
228 | ||
229 | # Check scope of pragma with eval | |
4438c4b7 | 230 | use warnings 'uninitialized' ; |
599cee73 | 231 | eval ' |
232 | my $b ; chop $b ; | |
233 | '; print STDERR $@ ; | |
234 | my $b ; chop $b ; | |
235 | EXPECT | |
b89fed5f | 236 | Use of uninitialized value in scalar chop at (eval 1) line 2. |
237 | Use of uninitialized value in scalar chop at - line 7. | |
599cee73 | 238 | ######## |
239 | ||
240 | # Check scope of pragma with eval | |
4438c4b7 | 241 | use warnings 'uninitialized' ; |
599cee73 | 242 | eval ' |
4438c4b7 | 243 | no warnings ; |
599cee73 | 244 | my $b ; chop $b ; |
245 | '; print STDERR $@ ; | |
246 | my $b ; chop $b ; | |
247 | EXPECT | |
b89fed5f | 248 | Use of uninitialized value in scalar chop at - line 8. |
599cee73 | 249 | ######## |
250 | ||
251 | # Check scope of pragma with eval | |
4438c4b7 | 252 | no warnings ; |
599cee73 | 253 | eval ' |
254 | 1 if $a EQ $b ; | |
255 | '; print STDERR $@ ; | |
256 | 1 if $a EQ $b ; | |
257 | EXPECT | |
258 | ||
259 | ######## | |
260 | ||
261 | # Check scope of pragma with eval | |
4438c4b7 | 262 | no warnings ; |
599cee73 | 263 | eval q[ |
4438c4b7 | 264 | use warnings 'deprecated' ; |
599cee73 | 265 | 1 if $a EQ $b ; |
266 | ]; print STDERR $@; | |
267 | 1 if $a EQ $b ; | |
268 | EXPECT | |
269 | Use of EQ is deprecated at (eval 1) line 3. | |
270 | ######## | |
271 | ||
272 | # Check scope of pragma with eval | |
4438c4b7 | 273 | use warnings 'deprecated' ; |
599cee73 | 274 | eval ' |
275 | 1 if $a EQ $b ; | |
276 | '; print STDERR $@; | |
277 | 1 if $a EQ $b ; | |
278 | EXPECT | |
279 | Use of EQ is deprecated at - line 7. | |
280 | Use of EQ is deprecated at (eval 1) line 2. | |
281 | ######## | |
282 | ||
283 | # Check scope of pragma with eval | |
4438c4b7 | 284 | use warnings 'deprecated' ; |
599cee73 | 285 | eval ' |
4438c4b7 | 286 | no warnings ; |
599cee73 | 287 | 1 if $a EQ $b ; |
288 | '; print STDERR $@; | |
289 | 1 if $a EQ $b ; | |
290 | EXPECT | |
291 | Use of EQ is deprecated at - line 8. | |
4438c4b7 | 292 | ######## |
293 | ||
294 | # Check the additive nature of the pragma | |
295 | 1 if $a EQ $b ; | |
296 | my $a ; chop $a ; | |
297 | use warnings 'deprecated' ; | |
298 | 1 if $a EQ $b ; | |
299 | my $b ; chop $b ; | |
300 | use warnings 'uninitialized' ; | |
301 | my $c ; chop $c ; | |
302 | no warnings 'deprecated' ; | |
303 | 1 if $a EQ $b ; | |
304 | EXPECT | |
305 | Use of EQ is deprecated at - line 6. | |
b89fed5f | 306 | Use of uninitialized value in scalar chop at - line 9. |
307 | Use of uninitialized value in string eq at - line 11. | |
308 | Use of uninitialized value in string eq at - line 11. |