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 | |
f89e79d6 | 60 | package abc; |
551cd33c | 61 | no warnings 'syntax' ; |
62 | my $a = 0; | |
63 | $a =+ 1 ; | |
599cee73 | 64 | 1; |
65 | --FILE-- | |
4438c4b7 | 66 | no warnings 'uninitialized' ; |
599cee73 | 67 | use abc; |
68 | my $a ; chop $a ; | |
69 | EXPECT | |
f89e79d6 | 70 | Reversed += operator at abc.pm line 4. |
29489e7c | 71 | Use of uninitialized value $a in scalar chop at - line 3. |
599cee73 | 72 | ######## |
73 | -W | |
74 | --FILE-- abc | |
f89e79d6 | 75 | package abc; |
551cd33c | 76 | no warnings 'syntax' ; |
77 | my $a = 0; | |
78 | $a =+ 1 ; | |
599cee73 | 79 | 1; |
80 | --FILE-- | |
4438c4b7 | 81 | no warnings 'uninitialized' ; |
599cee73 | 82 | require "./abc"; |
83 | my $a ; chop $a ; | |
84 | EXPECT | |
f89e79d6 | 85 | Reversed += operator at ./abc line 4. |
29489e7c | 86 | Use of uninitialized value $a in scalar chop at - line 3. |
599cee73 | 87 | ######## |
88 | -W | |
89 | --FILE-- abc.pm | |
f89e79d6 | 90 | package abc; |
599cee73 | 91 | BEGIN {$^W = 0} |
551cd33c | 92 | my $a = 0 ; |
93 | $a =+ 1 ; | |
599cee73 | 94 | 1; |
95 | --FILE-- | |
96 | $^W = 0 ; | |
97 | use abc; | |
98 | my $a ; chop $a ; | |
99 | EXPECT | |
f89e79d6 | 100 | Reversed += operator at abc.pm line 4. |
29489e7c | 101 | Use of uninitialized value $a in scalar chop at - line 3. |
599cee73 | 102 | ######## |
103 | -W | |
104 | --FILE-- abc | |
105 | BEGIN {$^W = 0} | |
551cd33c | 106 | my $a = 0 ; |
107 | $a =+ 1 ; | |
599cee73 | 108 | 1; |
109 | --FILE-- | |
110 | $^W = 0 ; | |
111 | require "./abc"; | |
112 | my $a ; chop $a ; | |
113 | EXPECT | |
551cd33c | 114 | Reversed += operator at ./abc line 3. |
29489e7c | 115 | Use of uninitialized value $a in scalar chop at - line 3. |
16ff4256 | 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 | } | |
126 | EXPECT | |
29489e7c | 127 | Use of uninitialized value $b in scalar chop at (eval 1) line 2. |
128 | Use of uninitialized value $b in scalar chop at - line 8. | |
16ff4256 | 129 | ######## |
130 | -W | |
131 | # Check scope of pragma with eval | |
132 | use 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 | } | |
141 | EXPECT | |
29489e7c | 142 | Use of uninitialized value $b in scalar chop at (eval 1) line 3. |
143 | Use of uninitialized value $b in scalar chop at - line 10. | |
16ff4256 | 144 | ######## |
145 | -W | |
146 | # Check scope of pragma with eval | |
147 | no warnings; | |
148 | { | |
149 | use warnings 'uninitialized' ; | |
150 | eval ' | |
151 | my $b ; chop $b ; | |
152 | '; print STDERR $@ ; | |
153 | my $b ; chop $b ; | |
154 | } | |
155 | EXPECT | |
29489e7c | 156 | Use of uninitialized value $b in scalar chop at (eval 1) line 2. |
157 | Use of uninitialized value $b in scalar chop at - line 9. | |
16ff4256 | 158 | ######## |
159 | -W | |
160 | # Check scope of pragma with eval | |
161 | no 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 | } | |
170 | EXPECT | |
29489e7c | 171 | Use of uninitialized value $b in scalar chop at (eval 1) line 3. |
172 | Use of uninitialized value $b in scalar chop at - line 10. | |
16ff4256 | 173 | ######## |
174 | -W | |
175 | # Check scope of pragma with eval | |
176 | use warnings; | |
177 | { | |
178 | my $a = "1"; my $b = "2"; | |
179 | no warnings ; | |
180 | eval q[ | |
551cd33c | 181 | use warnings 'syntax' ; |
182 | $a =+ 1 ; | |
16ff4256 | 183 | ]; print STDERR $@; |
551cd33c | 184 | $a =+ 1 ; |
16ff4256 | 185 | } |
186 | EXPECT | |
551cd33c | 187 | Reversed += operator at - line 11. |
188 | Reversed += operator at (eval 1) line 3. | |
16ff4256 | 189 | ######## |
190 | -W | |
191 | # Check scope of pragma with eval | |
192 | no 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 | 200 | } |
201 | EXPECT | |
551cd33c | 202 | Reversed += operator at - line 10. |
203 | Reversed += operator at (eval 1) line 2. | |
16ff4256 | 204 | ######## |
205 | -W | |
206 | # Check scope of pragma with eval | |
207 | no warnings; | |
208 | { | |
209 | my $a = "1"; my $b = "2"; | |
551cd33c | 210 | use warnings 'syntax' ; |
16ff4256 | 211 | eval ' |
212 | no warnings ; | |
551cd33c | 213 | $a =+ 1 ; |
16ff4256 | 214 | '; print STDERR $@; |
551cd33c | 215 | $a =+ 1 ; |
16ff4256 | 216 | } |
217 | EXPECT | |
551cd33c | 218 | Reversed += operator at - line 11. |
219 | Reversed += operator at (eval 1) line 3. |