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