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