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