doc tweak (from Michael G Schwern <schwern@pobox.com>)
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / 2use
CommitLineData
4438c4b7 1Check lexical warnings functionality
599cee73 2
3TODO
4 check that the warning hierarchy works.
5
6__END__
7
8# check illegal category is caught
4438c4b7 9use warnings 'blah' ;
599cee73 10EXPECT
11unknown warning category 'blah' at - line 3
12BEGIN failed--compilation aborted at - line 3.
13########
14
15# Check compile time scope of pragma
4438c4b7 16use warnings 'deprecated' ;
599cee73 17{
4438c4b7 18 no warnings ;
599cee73 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
4438c4b7 27no warnings;
599cee73 28{
4438c4b7 29 use warnings 'deprecated' ;
599cee73 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
4438c4b7 38use warnings 'uninitialized' ;
599cee73 39{
4438c4b7 40 no warnings ;
599cee73 41 my $b ; chop $b ;
42}
43my $b ; chop $b ;
44EXPECT
b89fed5f 45Use of uninitialized value in scalar chop at - line 8.
599cee73 46########
47
48# Check runtime scope of pragma
4438c4b7 49no warnings ;
599cee73 50{
4438c4b7 51 use warnings 'uninitialized' ;
599cee73 52 my $b ; chop $b ;
53}
54my $b ; chop $b ;
55EXPECT
b89fed5f 56Use of uninitialized value in scalar chop at - line 6.
599cee73 57########
58
59# Check runtime scope of pragma
4438c4b7 60no warnings ;
599cee73 61{
4438c4b7 62 use warnings 'uninitialized' ;
599cee73 63 $a = sub { my $b ; chop $b ; }
64}
65&$a ;
66EXPECT
b89fed5f 67Use of uninitialized value in scalar chop at - line 6.
599cee73 68########
69
4438c4b7 70use warnings 'deprecated' ;
599cee73 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--
4438c4b7 80use warnings 'deprecated' ;
599cee73 81require "./abc";
82EXPECT
83
84########
85
86--FILE-- abc
4438c4b7 87use warnings 'deprecated' ;
599cee73 881;
89--FILE--
90require "./abc";
911 if $a EQ $b ;
92EXPECT
93
94########
95
96--FILE-- abc
4438c4b7 97use warnings 'deprecated' ;
599cee73 981 if $a EQ $b ;
991;
100--FILE--
4438c4b7 101use warnings 'uninitialized' ;
599cee73 102require "./abc";
103my $a ; chop $a ;
104EXPECT
105Use of EQ is deprecated at ./abc line 2.
b89fed5f 106Use of uninitialized value in scalar chop at - line 3.
599cee73 107########
108
109--FILE-- abc.pm
4438c4b7 110use warnings 'deprecated' ;
599cee73 1111 if $a EQ $b ;
1121;
113--FILE--
4438c4b7 114use warnings 'uninitialized' ;
599cee73 115use abc;
116my $a ; chop $a ;
117EXPECT
118Use of EQ is deprecated at abc.pm line 2.
b89fed5f 119Use of uninitialized value in scalar chop at - line 3.
599cee73 120########
121
122# Check scope of pragma with eval
4438c4b7 123no warnings ;
599cee73 124eval {
125 my $b ; chop $b ;
126}; print STDERR $@ ;
127my $b ; chop $b ;
128EXPECT
129
130########
131
132# Check scope of pragma with eval
4438c4b7 133no warnings ;
599cee73 134eval {
4438c4b7 135 use warnings 'uninitialized' ;
599cee73 136 my $b ; chop $b ;
137}; print STDERR $@ ;
138my $b ; chop $b ;
139EXPECT
b89fed5f 140Use of uninitialized value in scalar chop at - line 6.
599cee73 141########
142
143# Check scope of pragma with eval
4438c4b7 144use warnings 'uninitialized' ;
599cee73 145eval {
146 my $b ; chop $b ;
147}; print STDERR $@ ;
148my $b ; chop $b ;
149EXPECT
b89fed5f 150Use of uninitialized value in scalar chop at - line 5.
151Use of uninitialized value in scalar chop at - line 7.
599cee73 152########
153
154# Check scope of pragma with eval
4438c4b7 155use warnings 'uninitialized' ;
599cee73 156eval {
4438c4b7 157 no warnings ;
599cee73 158 my $b ; chop $b ;
159}; print STDERR $@ ;
160my $b ; chop $b ;
161EXPECT
b89fed5f 162Use of uninitialized value in scalar chop at - line 8.
599cee73 163########
164
165# Check scope of pragma with eval
4438c4b7 166no warnings ;
599cee73 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
4438c4b7 176no warnings ;
599cee73 177eval {
4438c4b7 178 use warnings 'deprecated' ;
599cee73 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
4438c4b7 187use warnings 'deprecated' ;
599cee73 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
4438c4b7 198use warnings 'deprecated' ;
599cee73 199eval {
4438c4b7 200 no warnings ;
599cee73 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
4438c4b7 209no warnings ;
599cee73 210eval '
211 my $b ; chop $b ;
212'; print STDERR $@ ;
213my $b ; chop $b ;
214EXPECT
215
216########
217
218# Check scope of pragma with eval
4438c4b7 219no warnings ;
599cee73 220eval q[
4438c4b7 221 use warnings 'uninitialized' ;
599cee73 222 my $b ; chop $b ;
223]; print STDERR $@;
224my $b ; chop $b ;
225EXPECT
b89fed5f 226Use of uninitialized value in scalar chop at (eval 1) line 3.
599cee73 227########
228
229# Check scope of pragma with eval
4438c4b7 230use warnings 'uninitialized' ;
599cee73 231eval '
232 my $b ; chop $b ;
233'; print STDERR $@ ;
234my $b ; chop $b ;
235EXPECT
b89fed5f 236Use of uninitialized value in scalar chop at (eval 1) line 2.
237Use of uninitialized value in scalar chop at - line 7.
599cee73 238########
239
240# Check scope of pragma with eval
4438c4b7 241use warnings 'uninitialized' ;
599cee73 242eval '
4438c4b7 243 no warnings ;
599cee73 244 my $b ; chop $b ;
245'; print STDERR $@ ;
246my $b ; chop $b ;
247EXPECT
b89fed5f 248Use of uninitialized value in scalar chop at - line 8.
599cee73 249########
250
251# Check scope of pragma with eval
4438c4b7 252no warnings ;
599cee73 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
4438c4b7 262no warnings ;
599cee73 263eval q[
4438c4b7 264 use warnings 'deprecated' ;
599cee73 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
4438c4b7 273use warnings 'deprecated' ;
599cee73 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
4438c4b7 284use warnings 'deprecated' ;
599cee73 285eval '
4438c4b7 286 no warnings ;
599cee73 287 1 if $a EQ $b ;
288'; print STDERR $@;
2891 if $a EQ $b ;
290EXPECT
291Use of EQ is deprecated at - line 8.
4438c4b7 292########
293
294# Check the additive nature of the pragma
2951 if $a EQ $b ;
296my $a ; chop $a ;
297use warnings 'deprecated' ;
2981 if $a EQ $b ;
299my $b ; chop $b ;
300use warnings 'uninitialized' ;
301my $c ; chop $c ;
302no warnings 'deprecated' ;
3031 if $a EQ $b ;
304EXPECT
305Use of EQ is deprecated at - line 6.
b89fed5f 306Use of uninitialized value in scalar chop at - line 9.
307Use of uninitialized value in string eq at - line 11.
308Use of uninitialized value in string eq at - line 11.