Commit | Line | Data |
4438c4b7 |
1 | Check FATAL functionality |
2 | |
3 | __END__ |
4 | |
5 | # Check compile time warning |
551cd33c |
6 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
7 | { |
8 | no warnings ; |
551cd33c |
9 | $a =+ 1 ; |
4438c4b7 |
10 | } |
551cd33c |
11 | $a =+ 1 ; |
4438c4b7 |
12 | print STDERR "The End.\n" ; |
13 | EXPECT |
551cd33c |
14 | Reversed += operator at - line 8. |
4438c4b7 |
15 | ######## |
16 | |
d5a71f30 |
17 | # Check compile time warning |
18 | use warnings FATAL => 'all' ; |
19 | { |
20 | no warnings ; |
551cd33c |
21 | my $a =+ 1 ; |
d5a71f30 |
22 | } |
551cd33c |
23 | my $a =+ 1 ; |
d5a71f30 |
24 | print STDERR "The End.\n" ; |
25 | EXPECT |
551cd33c |
26 | Reversed += operator at - line 8. |
d5a71f30 |
27 | ######## |
28 | |
4438c4b7 |
29 | # Check runtime scope of pragma |
30 | use warnings FATAL => 'uninitialized' ; |
31 | { |
32 | no warnings ; |
33 | my $b ; chop $b ; |
34 | } |
35 | my $b ; chop $b ; |
36 | print STDERR "The End.\n" ; |
37 | EXPECT |
29489e7c |
38 | Use of uninitialized value $b in scalar chop at - line 8. |
4438c4b7 |
39 | ######## |
40 | |
41 | # Check runtime scope of pragma |
d5a71f30 |
42 | use warnings FATAL => 'all' ; |
43 | { |
44 | no warnings ; |
45 | my $b ; chop $b ; |
46 | } |
47 | my $b ; chop $b ; |
48 | print STDERR "The End.\n" ; |
49 | EXPECT |
29489e7c |
50 | Use of uninitialized value $b in scalar chop at - line 8. |
d5a71f30 |
51 | ######## |
52 | |
53 | # Check runtime scope of pragma |
4438c4b7 |
54 | no warnings ; |
55 | { |
56 | use warnings FATAL => 'uninitialized' ; |
57 | $a = sub { my $b ; chop $b ; } |
58 | } |
59 | &$a ; |
60 | print STDERR "The End.\n" ; |
61 | EXPECT |
29489e7c |
62 | Use of uninitialized value $b in scalar chop at - line 6. |
4438c4b7 |
63 | ######## |
d5a71f30 |
64 | |
65 | # Check runtime scope of pragma |
66 | no warnings ; |
67 | { |
68 | use warnings FATAL => 'all' ; |
69 | $a = sub { my $b ; chop $b ; } |
70 | } |
71 | &$a ; |
72 | print STDERR "The End.\n" ; |
73 | EXPECT |
29489e7c |
74 | Use of uninitialized value $b in scalar chop at - line 6. |
d5a71f30 |
75 | ######## |
4438c4b7 |
76 | |
77 | --FILE-- abc |
551cd33c |
78 | $a =+ 1 ; |
4438c4b7 |
79 | 1; |
80 | --FILE-- |
551cd33c |
81 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
82 | require "./abc"; |
83 | EXPECT |
84 | |
85 | ######## |
86 | |
87 | --FILE-- abc |
551cd33c |
88 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
89 | 1; |
90 | --FILE-- |
91 | require "./abc"; |
551cd33c |
92 | $a =+ 1 ; |
4438c4b7 |
93 | EXPECT |
94 | |
95 | ######## |
96 | |
97 | --FILE-- abc |
551cd33c |
98 | use warnings 'syntax' ; |
99 | $a =+ 1 ; |
4438c4b7 |
100 | 1; |
101 | --FILE-- |
102 | use warnings FATAL => 'uninitialized' ; |
103 | require "./abc"; |
104 | my $a ; chop $a ; |
105 | print STDERR "The End.\n" ; |
106 | EXPECT |
551cd33c |
107 | Reversed += operator at ./abc line 2. |
29489e7c |
108 | Use of uninitialized value $a in scalar chop at - line 3. |
4438c4b7 |
109 | ######## |
110 | |
111 | --FILE-- abc.pm |
551cd33c |
112 | use warnings 'syntax' ; |
113 | $a =+ 1 ; |
4438c4b7 |
114 | 1; |
115 | --FILE-- |
116 | use warnings FATAL => 'uninitialized' ; |
117 | use abc; |
118 | my $a ; chop $a ; |
119 | print STDERR "The End.\n" ; |
120 | EXPECT |
551cd33c |
121 | Reversed += operator at abc.pm line 2. |
29489e7c |
122 | Use of uninitialized value $a in scalar chop at - line 3. |
4438c4b7 |
123 | ######## |
124 | |
125 | # Check scope of pragma with eval |
126 | no warnings ; |
127 | eval { |
128 | use warnings FATAL => 'uninitialized' ; |
129 | my $b ; chop $b ; |
130 | }; print STDERR "-- $@" ; |
131 | my $b ; chop $b ; |
132 | print STDERR "The End.\n" ; |
133 | EXPECT |
29489e7c |
134 | -- Use of uninitialized value $b in scalar chop at - line 6. |
4438c4b7 |
135 | The End. |
136 | ######## |
137 | |
138 | # Check scope of pragma with eval |
139 | use warnings FATAL => 'uninitialized' ; |
140 | eval { |
141 | my $b ; chop $b ; |
142 | }; print STDERR "-- $@" ; |
143 | my $b ; chop $b ; |
144 | print STDERR "The End.\n" ; |
145 | EXPECT |
29489e7c |
146 | -- Use of uninitialized value $b in scalar chop at - line 5. |
147 | Use of uninitialized value $b in scalar chop at - line 7. |
4438c4b7 |
148 | ######## |
149 | |
150 | # Check scope of pragma with eval |
151 | use warnings FATAL => 'uninitialized' ; |
152 | eval { |
153 | no warnings ; |
154 | my $b ; chop $b ; |
155 | }; print STDERR $@ ; |
156 | my $b ; chop $b ; |
157 | print STDERR "The End.\n" ; |
158 | EXPECT |
29489e7c |
159 | Use of uninitialized value $b in scalar chop at - line 8. |
4438c4b7 |
160 | ######## |
161 | |
162 | # Check scope of pragma with eval |
163 | no warnings ; |
164 | eval { |
551cd33c |
165 | use warnings FATAL => 'syntax' ; |
166 | $a =+ 1 ; |
4438c4b7 |
167 | }; print STDERR "-- $@" ; |
551cd33c |
168 | $a =+ 1 ; |
4438c4b7 |
169 | print STDERR "The End.\n" ; |
170 | EXPECT |
551cd33c |
171 | Reversed += operator at - line 6. |
4438c4b7 |
172 | ######## |
173 | |
174 | # Check scope of pragma with eval |
551cd33c |
175 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
176 | eval { |
551cd33c |
177 | $a =+ 1 ; |
4438c4b7 |
178 | }; print STDERR "-- $@" ; |
551cd33c |
179 | $a =+ 1 ; |
4438c4b7 |
180 | print STDERR "The End.\n" ; |
181 | EXPECT |
551cd33c |
182 | Reversed += operator at - line 5. |
4438c4b7 |
183 | ######## |
184 | |
185 | # Check scope of pragma with eval |
551cd33c |
186 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
187 | eval { |
188 | no warnings ; |
551cd33c |
189 | $a =+ 1 ; |
4438c4b7 |
190 | }; print STDERR $@ ; |
551cd33c |
191 | $a =+ 1 ; |
4438c4b7 |
192 | print STDERR "The End.\n" ; |
193 | EXPECT |
551cd33c |
194 | Reversed += operator at - line 8. |
4438c4b7 |
195 | ######## |
196 | |
197 | # Check scope of pragma with eval |
198 | no warnings ; |
199 | eval { |
551cd33c |
200 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
201 | }; print STDERR $@ ; |
551cd33c |
202 | $a =+ 1 ; |
4438c4b7 |
203 | print STDERR "The End.\n" ; |
204 | EXPECT |
205 | The End. |
206 | ######## |
207 | |
208 | # Check scope of pragma with eval |
209 | no warnings ; |
210 | eval q[ |
211 | use warnings FATAL => 'uninitialized' ; |
212 | my $b ; chop $b ; |
213 | ]; print STDERR "-- $@"; |
214 | my $b ; chop $b ; |
215 | print STDERR "The End.\n" ; |
216 | EXPECT |
29489e7c |
217 | -- Use of uninitialized value $b in scalar chop at (eval 1) line 3. |
4438c4b7 |
218 | The End. |
219 | ######## |
220 | |
221 | # Check scope of pragma with eval |
222 | use warnings FATAL => 'uninitialized' ; |
223 | eval ' |
224 | my $b ; chop $b ; |
225 | '; print STDERR "-- $@" ; |
226 | my $b ; chop $b ; |
227 | print STDERR "The End.\n" ; |
228 | EXPECT |
29489e7c |
229 | -- Use of uninitialized value $b in scalar chop at (eval 1) line 2. |
230 | Use of uninitialized value $b in scalar chop at - line 7. |
4438c4b7 |
231 | ######## |
232 | |
233 | # Check scope of pragma with eval |
234 | use warnings FATAL => 'uninitialized' ; |
235 | eval ' |
236 | no warnings ; |
237 | my $b ; chop $b ; |
238 | '; print STDERR $@ ; |
239 | my $b ; chop $b ; |
240 | print STDERR "The End.\n" ; |
241 | EXPECT |
29489e7c |
242 | Use of uninitialized value $b in scalar chop at - line 8. |
4438c4b7 |
243 | ######## |
244 | |
245 | # Check scope of pragma with eval |
246 | no warnings ; |
247 | eval q[ |
551cd33c |
248 | use warnings FATAL => 'syntax' ; |
249 | $a =+ 1 ; |
4438c4b7 |
250 | ]; print STDERR "-- $@"; |
551cd33c |
251 | $a =+ 1 ; |
4438c4b7 |
252 | print STDERR "The End.\n" ; |
253 | EXPECT |
551cd33c |
254 | -- Reversed += operator at (eval 1) line 3. |
4438c4b7 |
255 | The End. |
256 | ######## |
257 | |
258 | # Check scope of pragma with eval |
551cd33c |
259 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
260 | eval ' |
551cd33c |
261 | $a =+ 1 ; |
4438c4b7 |
262 | '; print STDERR "-- $@"; |
263 | print STDERR "The End.\n" ; |
264 | EXPECT |
551cd33c |
265 | -- Reversed += operator at (eval 1) line 2. |
4438c4b7 |
266 | The End. |
267 | ######## |
268 | |
269 | # Check scope of pragma with eval |
551cd33c |
270 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
271 | eval ' |
272 | no warnings ; |
551cd33c |
273 | $a =+ 1 ; |
4438c4b7 |
274 | '; print STDERR "-- $@"; |
551cd33c |
275 | $a =+ 1 ; |
4438c4b7 |
276 | print STDERR "The End.\n" ; |
277 | EXPECT |
551cd33c |
278 | Reversed += operator at - line 8. |
f1f33818 |
279 | ######## |
2bd168e2 |
280 | # TODO ? !$Config{usethreads} && $::UTF8 && ($ENV{PERL_DESTRUCT_LEVEL} || 0) > 1 ? "Parser leaks OPs, which leak shared hash keys" : '' |
f1f33818 |
281 | |
282 | use warnings 'void' ; |
283 | |
284 | time ; |
285 | |
286 | { |
287 | use warnings FATAL => qw(void) ; |
288 | length "abc" ; |
289 | } |
290 | |
291 | join "", 1,2,3 ; |
292 | |
293 | print "done\n" ; |
294 | EXPECT |
295 | Useless use of time in void context at - line 4. |
296 | Useless use of length in void context at - line 8. |
297 | ######## |
2bd168e2 |
298 | # TODO ? !$Config{usethreads} && $::UTF8 && ($ENV{PERL_DESTRUCT_LEVEL} || 0) > 1 ? "Parser leaks OPs, which leak shared hash keys" : '' |
f1f33818 |
299 | |
300 | use warnings ; |
301 | |
302 | time ; |
303 | |
304 | { |
305 | use warnings FATAL => qw(void) ; |
306 | length "abc" ; |
307 | } |
308 | |
309 | join "", 1,2,3 ; |
310 | |
311 | print "done\n" ; |
312 | EXPECT |
313 | Useless use of time in void context at - line 4. |
314 | Useless use of length in void context at - line 8. |
08540116 |
315 | ######## |
316 | |
317 | use warnings FATAL => 'all'; |
318 | { |
319 | no warnings; |
320 | my $b ; chop $b; |
321 | { |
322 | use warnings ; |
323 | my $b ; chop $b; |
324 | } |
325 | } |
326 | my $b ; chop $b; |
327 | print STDERR "The End.\n" ; |
328 | EXPECT |
29489e7c |
329 | Use of uninitialized value $b in scalar chop at - line 8. |
330 | Use of uninitialized value $b in scalar chop at - line 11. |
08540116 |
331 | ######## |
332 | |
333 | use warnings FATAL => 'all'; |
334 | { |
335 | no warnings FATAL => 'all'; |
336 | my $b ; chop $b; |
337 | { |
338 | use warnings ; |
339 | my $b ; chop $b; |
340 | } |
341 | } |
342 | my $b ; chop $b; |
343 | print STDERR "The End.\n" ; |
344 | EXPECT |
29489e7c |
345 | Use of uninitialized value $b in scalar chop at - line 8. |
346 | Use of uninitialized value $b in scalar chop at - line 11. |
08540116 |
347 | ######## |
348 | |
349 | use warnings FATAL => 'all'; |
350 | { |
351 | no warnings 'syntax'; |
352 | { |
353 | use warnings ; |
354 | my $b ; chop $b; |
355 | } |
356 | } |
357 | my $b ; chop $b; |
358 | print STDERR "The End.\n" ; |
359 | EXPECT |
29489e7c |
360 | Use of uninitialized value $b in scalar chop at - line 7. |
6e9af7e4 |
361 | ######## |
362 | |
363 | use warnings FATAL => 'syntax', NONFATAL => 'void' ; |
364 | |
365 | length "abc"; |
366 | print STDERR "The End.\n" ; |
367 | EXPECT |
368 | Useless use of length in void context at - line 4. |
369 | The End. |
370 | ######## |
371 | |
372 | use warnings FATAL => 'all', NONFATAL => 'void' ; |
373 | |
374 | length "abc"; |
375 | print STDERR "The End.\n" ; |
376 | EXPECT |
377 | Useless use of length in void context at - line 4. |
378 | The End. |
379 | ######## |
380 | |
381 | use warnings FATAL => 'all', NONFATAL => 'void' ; |
382 | |
383 | my $a ; chomp $a; |
384 | length "abc"; |
385 | print STDERR "The End.\n" ; |
386 | EXPECT |
387 | Useless use of length in void context at - line 5. |
29489e7c |
388 | Use of uninitialized value $a in scalar chomp at - line 4. |
6e9af7e4 |
389 | ######## |
390 | |
391 | use warnings FATAL => 'void', NONFATAL => 'void' ; |
392 | |
393 | length "abc"; |
394 | print STDERR "The End.\n" ; |
395 | EXPECT |
396 | Useless use of length in void context at - line 4. |
397 | The End. |
398 | ######## |
2bd168e2 |
399 | # TODO ? !$Config{usethreads} && $::UTF8 && ($ENV{PERL_DESTRUCT_LEVEL} || 0) > 1 ? "Parser leaks OPs, which leak shared hash keys" : '' |
6e9af7e4 |
400 | |
401 | use warnings NONFATAL => 'void', FATAL => 'void' ; |
402 | |
403 | length "abc"; |
404 | print STDERR "The End.\n" ; |
405 | EXPECT |
406 | Useless use of length in void context at - line 4. |
407 | ######## |
408 | |
409 | use warnings FATAL => 'all', NONFATAL => 'io'; |
410 | no warnings 'once'; |
411 | |
412 | open(F, "<true\ncd"); |
413 | close "fred" ; |
414 | print STDERR "The End.\n" ; |
415 | EXPECT |
416 | Unsuccessful open on filename containing newline at - line 5. |
417 | close() on unopened filehandle fred at - line 6. |
418 | The End. |
419 | ######## |
420 | |
421 | use warnings FATAL => 'all', NONFATAL => 'io', FATAL => 'unopened' ; |
422 | no warnings 'once'; |
423 | |
424 | open(F, "<true\ncd"); |
425 | close "fred" ; |
426 | print STDERR "The End.\n" ; |
427 | EXPECT |
428 | Unsuccessful open on filename containing newline at - line 5. |
429 | close() on unopened filehandle fred at - line 6. |