autoquote barewords followed by newline and arrow properly
[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
d3a7d8c7 8# check illegal category is caught
327afb7f 9use warnings 'this-should-never-be-a-warning-category' ;
599cee73 10EXPECT
d3a7d8c7 11unknown warnings category 'this-should-never-be-a-warning-category' at - line 3
12BEGIN failed--compilation aborted at - line 3.
599cee73 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
16ff4256 123use warnings;
124{
125 no warnings ;
126 eval {
127 my $b ; chop $b ;
128 }; print STDERR $@ ;
599cee73 129 my $b ; chop $b ;
16ff4256 130}
599cee73 131EXPECT
132
133########
134
135# Check scope of pragma with eval
16ff4256 136use warnings;
137{
138 no warnings ;
139 eval {
140 use warnings 'uninitialized' ;
141 my $b ; chop $b ;
142 }; print STDERR $@ ;
599cee73 143 my $b ; chop $b ;
16ff4256 144}
599cee73 145EXPECT
16ff4256 146Use of uninitialized value in scalar chop at - line 8.
599cee73 147########
148
149# Check scope of pragma with eval
16ff4256 150no warnings;
151{
152 use warnings 'uninitialized' ;
153 eval {
154 my $b ; chop $b ;
155 }; print STDERR $@ ;
599cee73 156 my $b ; chop $b ;
16ff4256 157}
599cee73 158EXPECT
b89fed5f 159Use of uninitialized value in scalar chop at - line 7.
16ff4256 160Use of uninitialized value in scalar chop at - line 9.
599cee73 161########
162
163# Check scope of pragma with eval
16ff4256 164no warnings;
165{
166 use warnings 'uninitialized' ;
167 eval {
168 no warnings ;
169 my $b ; chop $b ;
170 }; print STDERR $@ ;
599cee73 171 my $b ; chop $b ;
16ff4256 172}
599cee73 173EXPECT
16ff4256 174Use of uninitialized value in scalar chop at - line 10.
599cee73 175########
176
177# Check scope of pragma with eval
16ff4256 178use warnings;
179{
180 no warnings ;
181 eval {
182 1 if $a EQ $b ;
183 }; print STDERR $@ ;
599cee73 184 1 if $a EQ $b ;
16ff4256 185}
599cee73 186EXPECT
187
188########
189
190# Check scope of pragma with eval
16ff4256 191use warnings;
192{
193 no warnings ;
194 eval {
195 use warnings 'deprecated' ;
196 1 if $a EQ $b ;
197 }; print STDERR $@ ;
599cee73 198 1 if $a EQ $b ;
16ff4256 199}
599cee73 200EXPECT
16ff4256 201Use of EQ is deprecated at - line 8.
599cee73 202########
203
204# Check scope of pragma with eval
16ff4256 205no warnings;
206{
207 use warnings 'deprecated' ;
208 eval {
209 1 if $a EQ $b ;
210 }; print STDERR $@ ;
599cee73 211 1 if $a EQ $b ;
16ff4256 212}
599cee73 213EXPECT
599cee73 214Use of EQ is deprecated at - line 7.
16ff4256 215Use of EQ is deprecated at - line 9.
599cee73 216########
217
218# Check scope of pragma with eval
16ff4256 219no warnings;
220{
221 use warnings 'deprecated' ;
222 eval {
223 no warnings ;
224 1 if $a EQ $b ;
225 }; print STDERR $@ ;
599cee73 226 1 if $a EQ $b ;
16ff4256 227}
599cee73 228EXPECT
16ff4256 229Use of EQ is deprecated at - line 10.
599cee73 230########
231
232# Check scope of pragma with eval
16ff4256 233use warnings;
234{
235 no warnings ;
236 eval '
237 my $b ; chop $b ;
238 '; print STDERR $@ ;
599cee73 239 my $b ; chop $b ;
16ff4256 240}
599cee73 241EXPECT
242
243########
244
245# Check scope of pragma with eval
16ff4256 246use warnings;
247{
248 no warnings ;
249 eval q[
250 use warnings 'uninitialized' ;
251 my $b ; chop $b ;
252 ]; print STDERR $@;
599cee73 253 my $b ; chop $b ;
16ff4256 254}
599cee73 255EXPECT
b89fed5f 256Use of uninitialized value in scalar chop at (eval 1) line 3.
599cee73 257########
258
259# Check scope of pragma with eval
16ff4256 260no warnings;
261{
262 use warnings 'uninitialized' ;
263 eval '
264 my $b ; chop $b ;
265 '; print STDERR $@ ;
599cee73 266 my $b ; chop $b ;
16ff4256 267}
599cee73 268EXPECT
b89fed5f 269Use of uninitialized value in scalar chop at (eval 1) line 2.
16ff4256 270Use of uninitialized value in scalar chop at - line 9.
599cee73 271########
272
273# Check scope of pragma with eval
16ff4256 274no warnings;
275{
276 use warnings 'uninitialized' ;
277 eval '
278 no warnings ;
279 my $b ; chop $b ;
280 '; print STDERR $@ ;
599cee73 281 my $b ; chop $b ;
16ff4256 282}
599cee73 283EXPECT
16ff4256 284Use of uninitialized value in scalar chop at - line 10.
599cee73 285########
286
287# Check scope of pragma with eval
16ff4256 288use warnings;
289{
290 no warnings ;
291 eval '
292 1 if $a EQ $b ;
293 '; print STDERR $@ ;
599cee73 294 1 if $a EQ $b ;
16ff4256 295}
599cee73 296EXPECT
297
298########
299
300# Check scope of pragma with eval
16ff4256 301use warnings;
302{
303 no warnings ;
304 eval q[
305 use warnings 'deprecated' ;
306 1 if $a EQ $b ;
307 ]; print STDERR $@;
599cee73 308 1 if $a EQ $b ;
16ff4256 309}
599cee73 310EXPECT
311Use of EQ is deprecated at (eval 1) line 3.
312########
313
314# Check scope of pragma with eval
16ff4256 315no warnings;
316{
317 use warnings 'deprecated' ;
318 eval '
319 1 if $a EQ $b ;
320 '; print STDERR $@;
599cee73 321 1 if $a EQ $b ;
16ff4256 322}
599cee73 323EXPECT
16ff4256 324Use of EQ is deprecated at - line 9.
599cee73 325Use of EQ is deprecated at (eval 1) line 2.
326########
327
328# Check scope of pragma with eval
16ff4256 329no warnings;
330{
331 use warnings 'deprecated' ;
332 eval '
333 no warnings ;
334 1 if $a EQ $b ;
335 '; print STDERR $@;
599cee73 336 1 if $a EQ $b ;
16ff4256 337}
599cee73 338EXPECT
16ff4256 339Use of EQ is deprecated at - line 10.
4438c4b7 340########
341
342# Check the additive nature of the pragma
3431 if $a EQ $b ;
344my $a ; chop $a ;
345use warnings 'deprecated' ;
3461 if $a EQ $b ;
347my $b ; chop $b ;
348use warnings 'uninitialized' ;
349my $c ; chop $c ;
350no warnings 'deprecated' ;
3511 if $a EQ $b ;
352EXPECT
353Use of EQ is deprecated at - line 6.
b89fed5f 354Use of uninitialized value in scalar chop at - line 9.
355Use of uninitialized value in string eq at - line 11.
356Use of uninitialized value in string eq at - line 11.