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