This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More test fixups for #11537.
[perl5.git] / t / lib / warnings / 4lint
CommitLineData
599cee73
PM
1Check lint
2
3__END__
4-W
5# lint: check compile time $^W is zapped
6BEGIN { $^W = 0 ;}
551cd33c
JH
7$a = 1 ;
8$a =+ 1 ;
599cee73
PM
9close STDIN ; print STDIN "abc" ;
10EXPECT
551cd33c 11Reversed += operator at - line 5.
43693395 12print() on closed filehandle STDIN at - line 6.
599cee73
PM
13########
14-W
15# lint: check runtime $^W is zapped
16$^W = 0 ;
17close STDIN ; print STDIN "abc" ;
18EXPECT
43693395 19print() on closed filehandle STDIN at - line 4.
599cee73
PM
20########
21-W
22# lint: check runtime $^W is zapped
23{
24 $^W = 0 ;
25 close STDIN ; print STDIN "abc" ;
26}
27EXPECT
43693395 28print() on closed filehandle STDIN at - line 5.
599cee73
PM
29########
30-W
4438c4b7
JH
31# lint: check "no warnings" is zapped
32no warnings ;
551cd33c
JH
33$a = 1 ;
34$a =+ 1 ;
599cee73
PM
35close STDIN ; print STDIN "abc" ;
36EXPECT
551cd33c 37Reversed += operator at - line 5.
43693395 38print() on closed filehandle STDIN at - line 6.
599cee73
PM
39########
40-W
4438c4b7 41# lint: check "no warnings" is zapped
599cee73 42{
4438c4b7 43 no warnings ;
599cee73
PM
44 close STDIN ; print STDIN "abc" ;
45}
46EXPECT
43693395 47print() on closed filehandle STDIN at - line 5.
599cee73
PM
48########
49-Ww
50# lint: check combination of -w and -W
51{
52 $^W = 0 ;
53 close STDIN ; print STDIN "abc" ;
54}
55EXPECT
43693395 56print() on closed filehandle STDIN at - line 5.
599cee73
PM
57########
58-W
59--FILE-- abc.pm
f89e79d6 60package abc;
551cd33c
JH
61no warnings 'syntax' ;
62my $a = 0;
63$a =+ 1 ;
599cee73
PM
641;
65--FILE--
4438c4b7 66no warnings 'uninitialized' ;
599cee73
PM
67use abc;
68my $a ; chop $a ;
69EXPECT
f89e79d6 70Reversed += operator at abc.pm line 4.
b89fed5f 71Use of uninitialized value in scalar chop at - line 3.
599cee73
PM
72########
73-W
74--FILE-- abc
f89e79d6 75package abc;
551cd33c
JH
76no warnings 'syntax' ;
77my $a = 0;
78$a =+ 1 ;
599cee73
PM
791;
80--FILE--
4438c4b7 81no warnings 'uninitialized' ;
599cee73
PM
82require "./abc";
83my $a ; chop $a ;
84EXPECT
f89e79d6 85Reversed += operator at ./abc line 4.
b89fed5f 86Use of uninitialized value in scalar chop at - line 3.
599cee73
PM
87########
88-W
89--FILE-- abc.pm
f89e79d6 90package abc;
599cee73 91BEGIN {$^W = 0}
551cd33c
JH
92my $a = 0 ;
93$a =+ 1 ;
599cee73
PM
941;
95--FILE--
96$^W = 0 ;
97use abc;
98my $a ; chop $a ;
99EXPECT
f89e79d6 100Reversed += operator at abc.pm line 4.
b89fed5f 101Use of uninitialized value in scalar chop at - line 3.
599cee73
PM
102########
103-W
104--FILE-- abc
105BEGIN {$^W = 0}
551cd33c
JH
106my $a = 0 ;
107$a =+ 1 ;
599cee73
PM
1081;
109--FILE--
110$^W = 0 ;
111require "./abc";
112my $a ; chop $a ;
113EXPECT
551cd33c 114Reversed += operator at ./abc line 3.
b89fed5f 115Use of uninitialized value in scalar chop at - line 3.
16ff4256
GS
116########
117-W
118# Check scope of pragma with eval
119{
120 no warnings ;
121 eval '
122 my $b ; chop $b ;
123 '; print STDERR $@ ;
124 my $b ; chop $b ;
125}
126EXPECT
127Use of uninitialized value in scalar chop at (eval 1) line 2.
128Use of uninitialized value in scalar chop at - line 8.
129########
130-W
131# Check scope of pragma with eval
132use warnings;
133{
134 no warnings ;
135 eval q[
136 use warnings 'uninitialized' ;
137 my $b ; chop $b ;
138 ]; print STDERR $@;
139 my $b ; chop $b ;
140}
141EXPECT
142Use of uninitialized value in scalar chop at (eval 1) line 3.
143Use of uninitialized value in scalar chop at - line 10.
144########
145-W
146# Check scope of pragma with eval
147no warnings;
148{
149 use warnings 'uninitialized' ;
150 eval '
151 my $b ; chop $b ;
152 '; print STDERR $@ ;
153 my $b ; chop $b ;
154}
155EXPECT
156Use of uninitialized value in scalar chop at (eval 1) line 2.
157Use of uninitialized value in scalar chop at - line 9.
158########
159-W
160# Check scope of pragma with eval
161no warnings;
162{
163 use warnings 'uninitialized' ;
164 eval '
165 no warnings ;
166 my $b ; chop $b ;
167 '; print STDERR $@ ;
168 my $b ; chop $b ;
169}
170EXPECT
171Use of uninitialized value in scalar chop at (eval 1) line 3.
172Use of uninitialized value in scalar chop at - line 10.
173########
174-W
175# Check scope of pragma with eval
176use warnings;
177{
178 my $a = "1"; my $b = "2";
179 no warnings ;
180 eval q[
551cd33c
JH
181 use warnings 'syntax' ;
182 $a =+ 1 ;
16ff4256 183 ]; print STDERR $@;
551cd33c 184 $a =+ 1 ;
16ff4256
GS
185}
186EXPECT
551cd33c
JH
187Reversed += operator at - line 11.
188Reversed += operator at (eval 1) line 3.
16ff4256
GS
189########
190-W
191# Check scope of pragma with eval
192no warnings;
193{
194 my $a = "1"; my $b = "2";
551cd33c 195 use warnings 'syntax' ;
16ff4256 196 eval '
551cd33c 197 $a =+ 1 ;
16ff4256 198 '; print STDERR $@;
551cd33c 199 $a =+ 1 ;
16ff4256
GS
200}
201EXPECT
551cd33c
JH
202Reversed += operator at - line 10.
203Reversed += operator at (eval 1) line 2.
16ff4256
GS
204########
205-W
206# Check scope of pragma with eval
207no warnings;
208{
209 my $a = "1"; my $b = "2";
551cd33c 210 use warnings 'syntax' ;
16ff4256
GS
211 eval '
212 no warnings ;
551cd33c 213 $a =+ 1 ;
16ff4256 214 '; print STDERR $@;
551cd33c 215 $a =+ 1 ;
16ff4256
GS
216}
217EXPECT
551cd33c
JH
218Reversed += operator at - line 11.
219Reversed += operator at (eval 1) line 3.