xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/lib/warnings/4lint (revision 0:68f95e015346)
1*0Sstevel@tonic-gateCheck lint
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gate__END__
4*0Sstevel@tonic-gate-W
5*0Sstevel@tonic-gate# lint: check compile time $^W is zapped
6*0Sstevel@tonic-gateBEGIN { $^W = 0 ;}
7*0Sstevel@tonic-gate$a = 1 ;
8*0Sstevel@tonic-gate$a =+ 1 ;
9*0Sstevel@tonic-gateclose STDIN ; print STDIN "abc" ;
10*0Sstevel@tonic-gateEXPECT
11*0Sstevel@tonic-gateReversed += operator at - line 5.
12*0Sstevel@tonic-gateprint() on closed filehandle STDIN at - line 6.
13*0Sstevel@tonic-gate########
14*0Sstevel@tonic-gate-W
15*0Sstevel@tonic-gate# lint: check runtime $^W is zapped
16*0Sstevel@tonic-gate$^W = 0 ;
17*0Sstevel@tonic-gateclose STDIN ; print STDIN "abc" ;
18*0Sstevel@tonic-gateEXPECT
19*0Sstevel@tonic-gateprint() on closed filehandle STDIN at - line 4.
20*0Sstevel@tonic-gate########
21*0Sstevel@tonic-gate-W
22*0Sstevel@tonic-gate# lint: check runtime $^W is zapped
23*0Sstevel@tonic-gate{
24*0Sstevel@tonic-gate  $^W = 0 ;
25*0Sstevel@tonic-gate  close STDIN ; print STDIN "abc" ;
26*0Sstevel@tonic-gate}
27*0Sstevel@tonic-gateEXPECT
28*0Sstevel@tonic-gateprint() on closed filehandle STDIN at - line 5.
29*0Sstevel@tonic-gate########
30*0Sstevel@tonic-gate-W
31*0Sstevel@tonic-gate# lint: check "no warnings" is zapped
32*0Sstevel@tonic-gateno warnings ;
33*0Sstevel@tonic-gate$a = 1 ;
34*0Sstevel@tonic-gate$a =+ 1 ;
35*0Sstevel@tonic-gateclose STDIN ; print STDIN "abc" ;
36*0Sstevel@tonic-gateEXPECT
37*0Sstevel@tonic-gateReversed += operator at - line 5.
38*0Sstevel@tonic-gateprint() on closed filehandle STDIN at - line 6.
39*0Sstevel@tonic-gate########
40*0Sstevel@tonic-gate-W
41*0Sstevel@tonic-gate# lint: check "no warnings" is zapped
42*0Sstevel@tonic-gate{
43*0Sstevel@tonic-gate  no warnings ;
44*0Sstevel@tonic-gate  close STDIN ; print STDIN "abc" ;
45*0Sstevel@tonic-gate}
46*0Sstevel@tonic-gateEXPECT
47*0Sstevel@tonic-gateprint() on closed filehandle STDIN at - line 5.
48*0Sstevel@tonic-gate########
49*0Sstevel@tonic-gate-Ww
50*0Sstevel@tonic-gate# lint: check combination of -w and -W
51*0Sstevel@tonic-gate{
52*0Sstevel@tonic-gate  $^W = 0 ;
53*0Sstevel@tonic-gate  close STDIN ; print STDIN "abc" ;
54*0Sstevel@tonic-gate}
55*0Sstevel@tonic-gateEXPECT
56*0Sstevel@tonic-gateprint() on closed filehandle STDIN at - line 5.
57*0Sstevel@tonic-gate########
58*0Sstevel@tonic-gate-W
59*0Sstevel@tonic-gate--FILE-- abc.pm
60*0Sstevel@tonic-gatepackage abc;
61*0Sstevel@tonic-gateno warnings 'syntax' ;
62*0Sstevel@tonic-gatemy $a = 0;
63*0Sstevel@tonic-gate$a =+ 1 ;
64*0Sstevel@tonic-gate1;
65*0Sstevel@tonic-gate--FILE--
66*0Sstevel@tonic-gateno warnings 'uninitialized' ;
67*0Sstevel@tonic-gateuse abc;
68*0Sstevel@tonic-gatemy $a ; chop $a ;
69*0Sstevel@tonic-gateEXPECT
70*0Sstevel@tonic-gateReversed += operator at abc.pm line 4.
71*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 3.
72*0Sstevel@tonic-gate########
73*0Sstevel@tonic-gate-W
74*0Sstevel@tonic-gate--FILE-- abc
75*0Sstevel@tonic-gatepackage abc;
76*0Sstevel@tonic-gateno warnings 'syntax' ;
77*0Sstevel@tonic-gatemy $a = 0;
78*0Sstevel@tonic-gate$a =+ 1 ;
79*0Sstevel@tonic-gate1;
80*0Sstevel@tonic-gate--FILE--
81*0Sstevel@tonic-gateno warnings 'uninitialized' ;
82*0Sstevel@tonic-gaterequire "./abc";
83*0Sstevel@tonic-gatemy $a ; chop $a ;
84*0Sstevel@tonic-gateEXPECT
85*0Sstevel@tonic-gateReversed += operator at ./abc line 4.
86*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 3.
87*0Sstevel@tonic-gate########
88*0Sstevel@tonic-gate-W
89*0Sstevel@tonic-gate--FILE-- abc.pm
90*0Sstevel@tonic-gatepackage abc;
91*0Sstevel@tonic-gateBEGIN {$^W = 0}
92*0Sstevel@tonic-gatemy $a = 0 ;
93*0Sstevel@tonic-gate$a =+ 1 ;
94*0Sstevel@tonic-gate1;
95*0Sstevel@tonic-gate--FILE--
96*0Sstevel@tonic-gate$^W = 0 ;
97*0Sstevel@tonic-gateuse abc;
98*0Sstevel@tonic-gatemy $a ; chop $a ;
99*0Sstevel@tonic-gateEXPECT
100*0Sstevel@tonic-gateReversed += operator at abc.pm line 4.
101*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 3.
102*0Sstevel@tonic-gate########
103*0Sstevel@tonic-gate-W
104*0Sstevel@tonic-gate--FILE-- abc
105*0Sstevel@tonic-gateBEGIN {$^W = 0}
106*0Sstevel@tonic-gatemy $a = 0 ;
107*0Sstevel@tonic-gate$a =+ 1 ;
108*0Sstevel@tonic-gate1;
109*0Sstevel@tonic-gate--FILE--
110*0Sstevel@tonic-gate$^W = 0 ;
111*0Sstevel@tonic-gaterequire "./abc";
112*0Sstevel@tonic-gatemy $a ; chop $a ;
113*0Sstevel@tonic-gateEXPECT
114*0Sstevel@tonic-gateReversed += operator at ./abc line 3.
115*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 3.
116*0Sstevel@tonic-gate########
117*0Sstevel@tonic-gate-W
118*0Sstevel@tonic-gate# Check scope of pragma with eval
119*0Sstevel@tonic-gate{
120*0Sstevel@tonic-gate    no warnings ;
121*0Sstevel@tonic-gate    eval '
122*0Sstevel@tonic-gate        my $b ; chop $b ;
123*0Sstevel@tonic-gate    '; print STDERR $@ ;
124*0Sstevel@tonic-gate    my $b ; chop $b ;
125*0Sstevel@tonic-gate}
126*0Sstevel@tonic-gateEXPECT
127*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at (eval 1) line 2.
128*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 8.
129*0Sstevel@tonic-gate########
130*0Sstevel@tonic-gate-W
131*0Sstevel@tonic-gate# Check scope of pragma with eval
132*0Sstevel@tonic-gateuse warnings;
133*0Sstevel@tonic-gate{
134*0Sstevel@tonic-gate    no warnings ;
135*0Sstevel@tonic-gate    eval q[
136*0Sstevel@tonic-gate        use warnings 'uninitialized' ;
137*0Sstevel@tonic-gate        my $b ; chop $b ;
138*0Sstevel@tonic-gate    ]; print STDERR $@;
139*0Sstevel@tonic-gate    my $b ; chop $b ;
140*0Sstevel@tonic-gate}
141*0Sstevel@tonic-gateEXPECT
142*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at (eval 1) line 3.
143*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 10.
144*0Sstevel@tonic-gate########
145*0Sstevel@tonic-gate-W
146*0Sstevel@tonic-gate# Check scope of pragma with eval
147*0Sstevel@tonic-gateno warnings;
148*0Sstevel@tonic-gate{
149*0Sstevel@tonic-gate    use warnings 'uninitialized' ;
150*0Sstevel@tonic-gate    eval '
151*0Sstevel@tonic-gate        my $b ; chop $b ;
152*0Sstevel@tonic-gate    '; print STDERR $@ ;
153*0Sstevel@tonic-gate    my $b ; chop $b ;
154*0Sstevel@tonic-gate}
155*0Sstevel@tonic-gateEXPECT
156*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at (eval 1) line 2.
157*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 9.
158*0Sstevel@tonic-gate########
159*0Sstevel@tonic-gate-W
160*0Sstevel@tonic-gate# Check scope of pragma with eval
161*0Sstevel@tonic-gateno warnings;
162*0Sstevel@tonic-gate{
163*0Sstevel@tonic-gate    use warnings 'uninitialized' ;
164*0Sstevel@tonic-gate    eval '
165*0Sstevel@tonic-gate        no warnings ;
166*0Sstevel@tonic-gate        my $b ; chop $b ;
167*0Sstevel@tonic-gate    '; print STDERR $@ ;
168*0Sstevel@tonic-gate    my $b ; chop $b ;
169*0Sstevel@tonic-gate}
170*0Sstevel@tonic-gateEXPECT
171*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at (eval 1) line 3.
172*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 10.
173*0Sstevel@tonic-gate########
174*0Sstevel@tonic-gate-W
175*0Sstevel@tonic-gate# Check scope of pragma with eval
176*0Sstevel@tonic-gateuse warnings;
177*0Sstevel@tonic-gate{
178*0Sstevel@tonic-gate    my $a = "1"; my $b = "2";
179*0Sstevel@tonic-gate    no warnings ;
180*0Sstevel@tonic-gate    eval q[
181*0Sstevel@tonic-gate        use warnings 'syntax' ;
182*0Sstevel@tonic-gate        $a =+ 1 ;
183*0Sstevel@tonic-gate    ]; print STDERR $@;
184*0Sstevel@tonic-gate    $a =+ 1 ;
185*0Sstevel@tonic-gate}
186*0Sstevel@tonic-gateEXPECT
187*0Sstevel@tonic-gateReversed += operator at - line 11.
188*0Sstevel@tonic-gateReversed += operator at (eval 1) line 3.
189*0Sstevel@tonic-gate########
190*0Sstevel@tonic-gate-W
191*0Sstevel@tonic-gate# Check scope of pragma with eval
192*0Sstevel@tonic-gateno warnings;
193*0Sstevel@tonic-gate{
194*0Sstevel@tonic-gate    my $a = "1"; my $b = "2";
195*0Sstevel@tonic-gate    use warnings 'syntax' ;
196*0Sstevel@tonic-gate    eval '
197*0Sstevel@tonic-gate        $a =+ 1 ;
198*0Sstevel@tonic-gate    '; print STDERR $@;
199*0Sstevel@tonic-gate    $a =+ 1 ;
200*0Sstevel@tonic-gate}
201*0Sstevel@tonic-gateEXPECT
202*0Sstevel@tonic-gateReversed += operator at - line 10.
203*0Sstevel@tonic-gateReversed += operator at (eval 1) line 2.
204*0Sstevel@tonic-gate########
205*0Sstevel@tonic-gate-W
206*0Sstevel@tonic-gate# Check scope of pragma with eval
207*0Sstevel@tonic-gateno warnings;
208*0Sstevel@tonic-gate{
209*0Sstevel@tonic-gate    my $a = "1"; my $b = "2";
210*0Sstevel@tonic-gate    use warnings 'syntax' ;
211*0Sstevel@tonic-gate    eval '
212*0Sstevel@tonic-gate        no warnings ;
213*0Sstevel@tonic-gate        $a =+ 1 ;
214*0Sstevel@tonic-gate    '; print STDERR $@;
215*0Sstevel@tonic-gate    $a =+ 1 ;
216*0Sstevel@tonic-gate}
217*0Sstevel@tonic-gateEXPECT
218*0Sstevel@tonic-gateReversed += operator at - line 11.
219*0Sstevel@tonic-gateReversed += operator at (eval 1) line 3.
220