Once more unto resync
[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
cb50131a 8# ignore unknown warning categories
9use warnings 'this-should-never-be-a-warning-category' ;
599cee73 10EXPECT
599cee73 11########
12
13# Check compile time scope of pragma
4438c4b7 14use warnings 'deprecated' ;
599cee73 15{
4438c4b7 16 no warnings ;
599cee73 17 1 if $a EQ $b ;
18}
191 if $a EQ $b ;
20EXPECT
21Use of EQ is deprecated at - line 8.
22########
23
24# Check compile time scope of pragma
4438c4b7 25no warnings;
599cee73 26{
4438c4b7 27 use warnings 'deprecated' ;
599cee73 28 1 if $a EQ $b ;
29}
301 if $a EQ $b ;
31EXPECT
32Use of EQ is deprecated at - line 6.
33########
34
35# Check runtime scope of pragma
4438c4b7 36use warnings 'uninitialized' ;
599cee73 37{
4438c4b7 38 no warnings ;
599cee73 39 my $b ; chop $b ;
40}
41my $b ; chop $b ;
42EXPECT
146174a9 43Use of uninitialized value in scalar chop at - line 8.
599cee73 44########
45
46# Check runtime scope of pragma
4438c4b7 47no warnings ;
599cee73 48{
4438c4b7 49 use warnings 'uninitialized' ;
599cee73 50 my $b ; chop $b ;
51}
52my $b ; chop $b ;
53EXPECT
146174a9 54Use of uninitialized value in scalar chop at - line 6.
599cee73 55########
56
57# Check runtime scope of pragma
4438c4b7 58no warnings ;
599cee73 59{
4438c4b7 60 use warnings 'uninitialized' ;
599cee73 61 $a = sub { my $b ; chop $b ; }
62}
63&$a ;
64EXPECT
146174a9 65Use of uninitialized value in scalar chop at - line 6.
599cee73 66########
67
4438c4b7 68use warnings 'deprecated' ;
599cee73 691 if $a EQ $b ;
70EXPECT
71Use of EQ is deprecated at - line 3.
72########
73
74--FILE-- abc
751 if $a EQ $b ;
761;
77--FILE--
4438c4b7 78use warnings 'deprecated' ;
599cee73 79require "./abc";
80EXPECT
81
82########
83
84--FILE-- abc
4438c4b7 85use warnings 'deprecated' ;
599cee73 861;
87--FILE--
88require "./abc";
891 if $a EQ $b ;
90EXPECT
91
92########
93
94--FILE-- abc
4438c4b7 95use warnings 'deprecated' ;
599cee73 961 if $a EQ $b ;
971;
98--FILE--
4438c4b7 99use warnings 'uninitialized' ;
599cee73 100require "./abc";
101my $a ; chop $a ;
102EXPECT
103Use of EQ is deprecated at ./abc line 2.
146174a9 104Use of uninitialized value in scalar chop at - line 3.
599cee73 105########
106
107--FILE-- abc.pm
4438c4b7 108use warnings 'deprecated' ;
599cee73 1091 if $a EQ $b ;
1101;
111--FILE--
4438c4b7 112use warnings 'uninitialized' ;
599cee73 113use abc;
114my $a ; chop $a ;
115EXPECT
116Use of EQ is deprecated at abc.pm line 2.
146174a9 117Use of uninitialized value in scalar chop at - line 3.
599cee73 118########
119
120# Check scope of pragma with eval
4438c4b7 121no warnings ;
599cee73 122eval {
123 my $b ; chop $b ;
124}; print STDERR $@ ;
125my $b ; chop $b ;
126EXPECT
127
128########
129
130# Check scope of pragma with eval
4438c4b7 131no warnings ;
599cee73 132eval {
4438c4b7 133 use warnings 'uninitialized' ;
599cee73 134 my $b ; chop $b ;
135}; print STDERR $@ ;
136my $b ; chop $b ;
137EXPECT
146174a9 138Use of uninitialized value in scalar chop at - line 6.
599cee73 139########
140
141# Check scope of pragma with eval
4438c4b7 142use warnings 'uninitialized' ;
599cee73 143eval {
144 my $b ; chop $b ;
145}; print STDERR $@ ;
146my $b ; chop $b ;
147EXPECT
146174a9 148Use of uninitialized value in scalar chop at - line 5.
149Use of uninitialized value in scalar chop at - line 7.
599cee73 150########
151
152# Check scope of pragma with eval
4438c4b7 153use warnings 'uninitialized' ;
599cee73 154eval {
4438c4b7 155 no warnings ;
599cee73 156 my $b ; chop $b ;
157}; print STDERR $@ ;
158my $b ; chop $b ;
159EXPECT
146174a9 160Use of uninitialized value in scalar chop at - line 8.
599cee73 161########
162
163# Check scope of pragma with eval
4438c4b7 164no warnings ;
599cee73 165eval {
166 1 if $a EQ $b ;
167}; print STDERR $@ ;
1681 if $a EQ $b ;
169EXPECT
170
171########
172
173# Check scope of pragma with eval
4438c4b7 174no warnings ;
599cee73 175eval {
4438c4b7 176 use warnings 'deprecated' ;
599cee73 177 1 if $a EQ $b ;
178}; print STDERR $@ ;
1791 if $a EQ $b ;
180EXPECT
181Use of EQ is deprecated at - line 6.
182########
183
184# Check scope of pragma with eval
4438c4b7 185use warnings 'deprecated' ;
599cee73 186eval {
187 1 if $a EQ $b ;
188}; print STDERR $@ ;
1891 if $a EQ $b ;
190EXPECT
191Use of EQ is deprecated at - line 5.
192Use of EQ is deprecated at - line 7.
193########
194
195# Check scope of pragma with eval
4438c4b7 196use warnings 'deprecated' ;
599cee73 197eval {
4438c4b7 198 no warnings ;
599cee73 199 1 if $a EQ $b ;
200}; print STDERR $@ ;
2011 if $a EQ $b ;
202EXPECT
203Use of EQ is deprecated at - line 8.
204########
205
206# Check scope of pragma with eval
4438c4b7 207no warnings ;
599cee73 208eval '
209 my $b ; chop $b ;
210'; print STDERR $@ ;
211my $b ; chop $b ;
212EXPECT
213
214########
215
216# Check scope of pragma with eval
4438c4b7 217no warnings ;
599cee73 218eval q[
4438c4b7 219 use warnings 'uninitialized' ;
599cee73 220 my $b ; chop $b ;
221]; print STDERR $@;
222my $b ; chop $b ;
223EXPECT
146174a9 224Use of uninitialized value in scalar chop at (eval 1) line 3.
599cee73 225########
226
227# Check scope of pragma with eval
4438c4b7 228use warnings 'uninitialized' ;
599cee73 229eval '
230 my $b ; chop $b ;
231'; print STDERR $@ ;
232my $b ; chop $b ;
233EXPECT
146174a9 234Use of uninitialized value in scalar chop at (eval 1) line 2.
235Use of uninitialized value in scalar chop at - line 7.
599cee73 236########
237
238# Check scope of pragma with eval
4438c4b7 239use warnings 'uninitialized' ;
599cee73 240eval '
4438c4b7 241 no warnings ;
599cee73 242 my $b ; chop $b ;
243'; print STDERR $@ ;
244my $b ; chop $b ;
245EXPECT
146174a9 246Use of uninitialized value in scalar chop at - line 8.
599cee73 247########
248
249# Check scope of pragma with eval
4438c4b7 250no warnings ;
599cee73 251eval '
252 1 if $a EQ $b ;
253'; print STDERR $@ ;
2541 if $a EQ $b ;
255EXPECT
256
257########
258
259# Check scope of pragma with eval
4438c4b7 260no warnings ;
599cee73 261eval q[
4438c4b7 262 use warnings 'deprecated' ;
599cee73 263 1 if $a EQ $b ;
264]; print STDERR $@;
2651 if $a EQ $b ;
266EXPECT
267Use of EQ is deprecated at (eval 1) line 3.
268########
269
270# Check scope of pragma with eval
4438c4b7 271use warnings 'deprecated' ;
599cee73 272eval '
273 1 if $a EQ $b ;
274'; print STDERR $@;
2751 if $a EQ $b ;
276EXPECT
277Use of EQ is deprecated at - line 7.
278Use of EQ is deprecated at (eval 1) line 2.
279########
280
281# Check scope of pragma with eval
4438c4b7 282use warnings 'deprecated' ;
599cee73 283eval '
4438c4b7 284 no warnings ;
599cee73 285 1 if $a EQ $b ;
286'; print STDERR $@;
2871 if $a EQ $b ;
288EXPECT
289Use of EQ is deprecated at - line 8.
4438c4b7 290########
291
292# Check the additive nature of the pragma
2931 if $a EQ $b ;
294my $a ; chop $a ;
295use warnings 'deprecated' ;
2961 if $a EQ $b ;
297my $b ; chop $b ;
298use warnings 'uninitialized' ;
299my $c ; chop $c ;
300no warnings 'deprecated' ;
3011 if $a EQ $b ;
302EXPECT
303Use of EQ is deprecated at - line 6.
146174a9 304Use of uninitialized value in scalar chop at - line 9.
305Use of uninitialized value in string eq at - line 11.
306Use of uninitialized value in string eq at - line 11.