new test (from Michael G Schwern <schwern@pobox.com>)
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / 7fatal
CommitLineData
4438c4b7 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
17# Check runtime scope of pragma
18use warnings FATAL => 'uninitialized' ;
19{
20 no warnings ;
21 my $b ; chop $b ;
22}
23my $b ; chop $b ;
24print STDERR "The End.\n" ;
25EXPECT
b89fed5f 26Use of uninitialized value in scalar chop at - line 8.
4438c4b7 27########
28
29# Check runtime scope of pragma
30no warnings ;
31{
32 use warnings FATAL => 'uninitialized' ;
33 $a = sub { my $b ; chop $b ; }
34}
35&$a ;
36print STDERR "The End.\n" ;
37EXPECT
b89fed5f 38Use of uninitialized value in scalar chop at - line 6.
4438c4b7 39########
40
41--FILE-- abc
421 if $a EQ $b ;
431;
44--FILE--
45use warnings FATAL => 'deprecated' ;
46require "./abc";
47EXPECT
48
49########
50
51--FILE-- abc
52use warnings FATAL => 'deprecated' ;
531;
54--FILE--
55require "./abc";
561 if $a EQ $b ;
57EXPECT
58
59########
60
61--FILE-- abc
62use warnings 'deprecated' ;
631 if $a EQ $b ;
641;
65--FILE--
66use warnings FATAL => 'uninitialized' ;
67require "./abc";
68my $a ; chop $a ;
69print STDERR "The End.\n" ;
70EXPECT
71Use of EQ is deprecated at ./abc line 2.
b89fed5f 72Use of uninitialized value in scalar chop at - line 3.
4438c4b7 73########
74
75--FILE-- abc.pm
76use warnings 'deprecated' ;
771 if $a EQ $b ;
781;
79--FILE--
80use warnings FATAL => 'uninitialized' ;
81use abc;
82my $a ; chop $a ;
83print STDERR "The End.\n" ;
84EXPECT
85Use of EQ is deprecated at abc.pm line 2.
b89fed5f 86Use of uninitialized value in scalar chop at - line 3.
4438c4b7 87########
88
89# Check scope of pragma with eval
90no warnings ;
91eval {
92 use warnings FATAL => 'uninitialized' ;
93 my $b ; chop $b ;
94}; print STDERR "-- $@" ;
95my $b ; chop $b ;
96print STDERR "The End.\n" ;
97EXPECT
b89fed5f 98-- Use of uninitialized value in scalar chop at - line 6.
4438c4b7 99The End.
100########
101
102# Check scope of pragma with eval
103use warnings FATAL => 'uninitialized' ;
104eval {
105 my $b ; chop $b ;
106}; print STDERR "-- $@" ;
107my $b ; chop $b ;
108print STDERR "The End.\n" ;
109EXPECT
b89fed5f 110-- Use of uninitialized value in scalar chop at - line 5.
111Use of uninitialized value in scalar chop at - line 7.
4438c4b7 112########
113
114# Check scope of pragma with eval
115use warnings FATAL => 'uninitialized' ;
116eval {
117 no warnings ;
118 my $b ; chop $b ;
119}; print STDERR $@ ;
120my $b ; chop $b ;
121print STDERR "The End.\n" ;
122EXPECT
b89fed5f 123Use of uninitialized value in scalar chop at - line 8.
4438c4b7 124########
125
126# Check scope of pragma with eval
127no warnings ;
128eval {
129 use warnings FATAL => 'deprecated' ;
130 1 if $a EQ $b ;
131}; print STDERR "-- $@" ;
1321 if $a EQ $b ;
133print STDERR "The End.\n" ;
134EXPECT
135Use of EQ is deprecated at - line 6.
136########
137
138# Check scope of pragma with eval
139use warnings FATAL => 'deprecated' ;
140eval {
141 1 if $a EQ $b ;
142}; print STDERR "-- $@" ;
1431 if $a EQ $b ;
144print STDERR "The End.\n" ;
145EXPECT
146Use of EQ is deprecated at - line 5.
147########
148
149# Check scope of pragma with eval
150use warnings FATAL => 'deprecated' ;
151eval {
152 no warnings ;
153 1 if $a EQ $b ;
154}; print STDERR $@ ;
1551 if $a EQ $b ;
156print STDERR "The End.\n" ;
157EXPECT
158Use of EQ is deprecated at - line 8.
159########
160
161# Check scope of pragma with eval
162no warnings ;
163eval {
164 use warnings FATAL => 'deprecated' ;
165}; print STDERR $@ ;
1661 if $a EQ $b ;
167print STDERR "The End.\n" ;
168EXPECT
169The End.
170########
171
172# Check scope of pragma with eval
173no warnings ;
174eval q[
175 use warnings FATAL => 'uninitialized' ;
176 my $b ; chop $b ;
177]; print STDERR "-- $@";
178my $b ; chop $b ;
179print STDERR "The End.\n" ;
180EXPECT
b89fed5f 181-- Use of uninitialized value in scalar chop at (eval 1) line 3.
4438c4b7 182The End.
183########
184
185# Check scope of pragma with eval
186use warnings FATAL => 'uninitialized' ;
187eval '
188 my $b ; chop $b ;
189'; print STDERR "-- $@" ;
190my $b ; chop $b ;
191print STDERR "The End.\n" ;
192EXPECT
b89fed5f 193-- Use of uninitialized value in scalar chop at (eval 1) line 2.
194Use of uninitialized value in scalar chop at - line 7.
4438c4b7 195########
196
197# Check scope of pragma with eval
198use warnings FATAL => 'uninitialized' ;
199eval '
200 no warnings ;
201 my $b ; chop $b ;
202'; print STDERR $@ ;
203my $b ; chop $b ;
204print STDERR "The End.\n" ;
205EXPECT
b89fed5f 206Use of uninitialized value in scalar chop at - line 8.
4438c4b7 207########
208
209# Check scope of pragma with eval
210no warnings ;
211eval q[
212 use warnings FATAL => 'deprecated' ;
213 1 if $a EQ $b ;
214]; print STDERR "-- $@";
2151 if $a EQ $b ;
216print STDERR "The End.\n" ;
217EXPECT
218-- Use of EQ is deprecated at (eval 1) line 3.
219The End.
220########
221
222# Check scope of pragma with eval
223use warnings FATAL => 'deprecated' ;
224eval '
225 1 if $a EQ $b ;
226'; print STDERR "-- $@";
227print STDERR "The End.\n" ;
228EXPECT
229-- Use of EQ is deprecated at (eval 1) line 2.
230The End.
231########
232
233# Check scope of pragma with eval
234use warnings FATAL => 'deprecated' ;
235eval '
236 no warnings ;
237 1 if $a EQ $b ;
238'; print STDERR "-- $@";
2391 if $a EQ $b ;
240print STDERR "The End.\n" ;
241EXPECT
242Use of EQ is deprecated at - line 8.