This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fixes for bugs in C<use warnings qw(FATAL all)> (from Paul Marquess)
[perl5.git] / t / pragma / warn / 7fatal
CommitLineData
4438c4b7
JH
1Check FATAL functionality
2
3__END__
4
5# Check compile time warning
6use warnings FATAL => 'deprecated' ;
7{
8 no warnings ;
9 1 if $a EQ $b ;
10}
111 if $a EQ $b ;
12print STDERR "The End.\n" ;
13EXPECT
14Use of EQ is deprecated at - line 8.
15########
16
d5a71f30
GS
17# Check compile time warning
18use warnings FATAL => 'all' ;
19{
20 no warnings ;
21 1 if $a EQ $b ;
22}
231 if $a EQ $b ;
24print STDERR "The End.\n" ;
25EXPECT
26Use of EQ is deprecated at - line 8.
27########
28
4438c4b7
JH
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
b89fed5f 38Use of uninitialized value in scalar chop at - line 8.
4438c4b7
JH
39########
40
41# Check runtime scope of pragma
d5a71f30
GS
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
JH
54no warnings ;
55{
56 use warnings FATAL => 'uninitialized' ;
57 $a = sub { my $b ; chop $b ; }
58}
59&$a ;
60print STDERR "The End.\n" ;
61EXPECT
b89fed5f 62Use of uninitialized value in scalar chop at - line 6.
4438c4b7 63########
d5a71f30
GS
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
JH
76
77--FILE-- abc
781 if $a EQ $b ;
791;
80--FILE--
81use warnings FATAL => 'deprecated' ;
82require "./abc";
83EXPECT
84
85########
86
87--FILE-- abc
88use warnings FATAL => 'deprecated' ;
891;
90--FILE--
91require "./abc";
921 if $a EQ $b ;
93EXPECT
94
95########
96
97--FILE-- abc
98use warnings 'deprecated' ;
991 if $a EQ $b ;
1001;
101--FILE--
102use warnings FATAL => 'uninitialized' ;
103require "./abc";
104my $a ; chop $a ;
105print STDERR "The End.\n" ;
106EXPECT
107Use of EQ is deprecated at ./abc line 2.
b89fed5f 108Use of uninitialized value in scalar chop at - line 3.
4438c4b7
JH
109########
110
111--FILE-- abc.pm
112use warnings 'deprecated' ;
1131 if $a EQ $b ;
1141;
115--FILE--
116use warnings FATAL => 'uninitialized' ;
117use abc;
118my $a ; chop $a ;
119print STDERR "The End.\n" ;
120EXPECT
121Use of EQ is deprecated at abc.pm line 2.
b89fed5f 122Use of uninitialized value in scalar chop at - line 3.
4438c4b7
JH
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
b89fed5f 134-- Use of uninitialized value in scalar chop at - line 6.
4438c4b7
JH
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
b89fed5f
GS
146-- Use of uninitialized value in scalar chop at - line 5.
147Use of uninitialized value in scalar chop at - line 7.
4438c4b7
JH
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
b89fed5f 159Use of uninitialized value in scalar chop at - line 8.
4438c4b7
JH
160########
161
162# Check scope of pragma with eval
163no warnings ;
164eval {
165 use warnings FATAL => 'deprecated' ;
166 1 if $a EQ $b ;
167}; print STDERR "-- $@" ;
1681 if $a EQ $b ;
169print STDERR "The End.\n" ;
170EXPECT
171Use of EQ is deprecated at - line 6.
172########
173
174# Check scope of pragma with eval
175use warnings FATAL => 'deprecated' ;
176eval {
177 1 if $a EQ $b ;
178}; print STDERR "-- $@" ;
1791 if $a EQ $b ;
180print STDERR "The End.\n" ;
181EXPECT
182Use of EQ is deprecated at - line 5.
183########
184
185# Check scope of pragma with eval
186use warnings FATAL => 'deprecated' ;
187eval {
188 no warnings ;
189 1 if $a EQ $b ;
190}; print STDERR $@ ;
1911 if $a EQ $b ;
192print STDERR "The End.\n" ;
193EXPECT
194Use of EQ is deprecated at - line 8.
195########
196
197# Check scope of pragma with eval
198no warnings ;
199eval {
200 use warnings FATAL => 'deprecated' ;
201}; print STDERR $@ ;
2021 if $a EQ $b ;
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
b89fed5f 217-- Use of uninitialized value in scalar chop at (eval 1) line 3.
4438c4b7
JH
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
b89fed5f
GS
229-- Use of uninitialized value in scalar chop at (eval 1) line 2.
230Use of uninitialized value in scalar chop at - line 7.
4438c4b7
JH
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
b89fed5f 242Use of uninitialized value in scalar chop at - line 8.
4438c4b7
JH
243########
244
245# Check scope of pragma with eval
246no warnings ;
247eval q[
248 use warnings FATAL => 'deprecated' ;
249 1 if $a EQ $b ;
250]; print STDERR "-- $@";
2511 if $a EQ $b ;
252print STDERR "The End.\n" ;
253EXPECT
254-- Use of EQ is deprecated at (eval 1) line 3.
255The End.
256########
257
258# Check scope of pragma with eval
259use warnings FATAL => 'deprecated' ;
260eval '
261 1 if $a EQ $b ;
262'; print STDERR "-- $@";
263print STDERR "The End.\n" ;
264EXPECT
265-- Use of EQ is deprecated at (eval 1) line 2.
266The End.
267########
268
269# Check scope of pragma with eval
270use warnings FATAL => 'deprecated' ;
271eval '
272 no warnings ;
273 1 if $a EQ $b ;
274'; print STDERR "-- $@";
2751 if $a EQ $b ;
276print STDERR "The End.\n" ;
277EXPECT
278Use of EQ is deprecated at - line 8.