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