This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Generate the deprecation warnings for all uses $* or $#.
[perl5.git] / t / lib / warnings / util
1   util.c AOK
2  
3      Illegal octal digit ignored 
4         my $a = oct "029" ;
5
6      Illegal hex digit ignored 
7         my $a = hex "0xv9" ;
8
9      Illegal binary digit ignored
10       my $a = oct "0b9" ;
11      
12      Integer overflow in binary number
13         my $a =  oct "0b111111111111111111111111111111111111111111" ;
14      Binary number > 0b11111111111111111111111111111111 non-portable
15         $a =  oct "0b111111111111111111111111111111111" ;
16      Integer overflow in octal number
17         my $a =  oct "077777777777777777777777777777" ;
18      Octal number > 037777777777 non-portable
19         $a =  oct "0047777777777" ;
20      Integer overflow in hexadecimal number
21         my $a =  hex "0xffffffffffffffffffff" ;
22      Hexadecimal number > 0xffffffff non-portable
23         $a =  hex "0x1ffffffff" ;
24
25 __END__
26 # util.c
27 use warnings 'digit' ;
28 my $a = oct "029" ;
29 no warnings 'digit' ;
30 $a = oct "029" ;
31 EXPECT
32 Illegal octal digit '9' ignored at - line 3.
33 ########
34 # util.c
35 use warnings 'digit' ;
36 my $a =  hex "0xv9" ;
37 no warnings 'digit' ;
38 $a =  hex "0xv9" ;
39 EXPECT
40 Illegal hexadecimal digit 'v' ignored at - line 3.
41 ########
42 # util.c
43 use warnings 'digit' ;
44 my $a =  oct "0b9" ;
45 no warnings 'digit' ;
46 $a =  oct "0b9" ;
47 EXPECT
48 Illegal binary digit '9' ignored at - line 3.
49 ########
50 # util.c
51 use warnings 'overflow' ;
52 my $a =  oct "0b11111111111111111111111111111111111111111111111111111111111111111";
53 no warnings 'overflow' ;
54 $a =  oct "0b11111111111111111111111111111111111111111111111111111111111111111";
55 EXPECT
56 Integer overflow in binary number at - line 3.
57 ########
58 # util.c
59 use warnings 'overflow' ;
60 my $a =  hex "0xffffffffffffffffffff" ;
61 no warnings 'overflow' ;
62 $a =  hex "0xffffffffffffffffffff" ;
63 EXPECT
64 Integer overflow in hexadecimal number at - line 3.
65 ########
66 # util.c
67 use warnings 'overflow' ;
68 my $a =  oct "077777777777777777777777777777" ;
69 no warnings 'overflow' ;
70 $a =  oct "077777777777777777777777777777" ;
71 EXPECT
72 Integer overflow in octal number at - line 3.
73 ########
74 # util.c
75 use warnings 'portable' ;
76 my $a =  oct "0b011111111111111111111111111111110" ;
77    $a =  oct "0b011111111111111111111111111111111" ;
78    $a =  oct "0b111111111111111111111111111111111" ;
79 no warnings 'portable' ;
80    $a =  oct "0b011111111111111111111111111111110" ;
81    $a =  oct "0b011111111111111111111111111111111" ;
82    $a =  oct "0b111111111111111111111111111111111" ;
83 EXPECT
84 Binary number > 0b11111111111111111111111111111111 non-portable at - line 5.
85 ########
86 # util.c
87 use warnings 'portable' ;
88 my $a =  hex "0x0fffffffe" ;
89    $a =  hex "0x0ffffffff" ;
90    $a =  hex "0x1ffffffff" ;
91 no warnings 'portable' ;
92    $a =  hex "0x0fffffffe" ;
93    $a =  hex "0x0ffffffff" ;
94    $a =  hex "0x1ffffffff" ;
95 EXPECT
96 Hexadecimal number > 0xffffffff non-portable at - line 5.
97 ########
98 # util.c
99 use warnings 'portable' ;
100 my $a =  oct "0037777777776" ;
101    $a =  oct "0037777777777" ;
102    $a =  oct "0047777777777" ;
103 no warnings 'portable' ;
104    $a =  oct "0037777777776" ;
105    $a =  oct "0037777777777" ;
106    $a =  oct "0047777777777" ;
107 EXPECT
108 Octal number > 037777777777 non-portable at - line 5.
109 ########
110 # util.c
111 use warnings;
112 $x = 1;
113 if ($x) {
114     print $y;
115 }
116 EXPECT
117 Name "main::y" used only once: possible typo at - line 5.
118 Use of uninitialized value $y in print at - line 5.
119 ########
120 # util.c
121 use warnings;
122 $x = 1;
123 if ($x) {
124     $x++;
125     print $y;
126 }
127 EXPECT
128 Name "main::y" used only once: possible typo at - line 6.
129 Use of uninitialized value $y in print at - line 6.
130 ########
131 # util.c
132 use warnings;
133 $x = 0;
134 if ($x) {
135     print "1\n";
136 } elsif (!$x) {
137     print $y;
138 } else {
139     print "0\n";
140 }
141 EXPECT
142 Name "main::y" used only once: possible typo at - line 7.
143 Use of uninitialized value $y in print at - line 7.
144 ########
145 # util.c
146 use warnings;
147 $x = 0;
148 if ($x) {
149     print "1\n";
150 } elsif (!$x) {
151     $x++;
152     print $y;
153 } else {
154     print "0\n";
155 }
156 EXPECT
157 Name "main::y" used only once: possible typo at - line 8.
158 Use of uninitialized value $y in print at - line 8.
159 ########
160 # util.c
161 use utf8;
162 use open qw( :utf8 :std );
163 use warnings;
164 $ㄒ = 1;
165 if ($ㄒ) {
166     print $ʎ;
167 }
168 EXPECT
169 Name "main::ʎ" used only once: possible typo at - line 7.
170 Use of uninitialized value $ʎ in print at - line 7.
171 ########
172 # util.c
173 use utf8;
174 use open qw( :utf8 :std );
175 use warnings;
176 $ㄒ = 1;
177 if ($ㄒ) {
178     $ㄒ++;
179     print $ʎ;
180 }
181 EXPECT
182 Name "main::ʎ" used only once: possible typo at - line 8.
183 Use of uninitialized value $ʎ in print at - line 8.
184 ########
185 # util.c
186 use utf8;
187 use open qw( :utf8 :std );
188 use warnings;
189 $ㄒ = 0;
190 if ($ㄒ) {
191     print "1\n";
192 } elsif (!$ㄒ) {
193     print $ʎ;
194 } else {
195     print "0\n";
196 }
197 EXPECT
198 Name "main::ʎ" used only once: possible typo at - line 9.
199 Use of uninitialized value $ʎ in print at - line 9.
200 ########
201 # util.c
202 use utf8;
203 use open qw( :utf8 :std );
204 use warnings;
205 $ㄒ = 0;
206 if ($ㄒ) {
207     print "1\n";
208 } elsif (!$ㄒ) {
209     $ㄒ++;
210     print $ʎ;
211 } else {
212     print "0\n";
213 }
214 EXPECT
215 Name "main::ʎ" used only once: possible typo at - line 10.
216 Use of uninitialized value $ʎ in print at - line 10.
217 ########
218 # util.c
219 use utf8;
220 use open qw( :utf8 :std );
221 use warnings;
222 package 팣칵ぇ;
223 $ㄒ = 1;
224 if ($ㄒ) {
225     print $ʎ;
226 }
227 EXPECT
228 Name "팣칵ぇ::ʎ" used only once: possible typo at - line 8.
229 Use of uninitialized value $팣칵ぇ::ʎ in print at - line 8.
230 ########
231 # util.c
232 use utf8;
233 use open qw( :utf8 :std );
234 use warnings;
235 package 팣칵ぇ;
236 $ㄒ = 1;
237 if ($ㄒ) {
238     $ㄒ++;
239     print $ʎ;
240 }
241 EXPECT
242 Name "팣칵ぇ::ʎ" used only once: possible typo at - line 9.
243 Use of uninitialized value $팣칵ぇ::ʎ in print at - line 9.
244 ########
245 # util.c
246 use utf8;
247 use open qw( :utf8 :std );
248 use warnings;
249 package 팣칵ぇ;
250 $ㄒ = 0;
251 if ($ㄒ) {
252     print "1\n";
253 } elsif (!$ㄒ) {
254     print $ʎ;
255 } else {
256     print "0\n";
257 }
258 EXPECT
259 Name "팣칵ぇ::ʎ" used only once: possible typo at - line 10.
260 Use of uninitialized value $팣칵ぇ::ʎ in print at - line 10.
261 ########
262 # util.c
263 use utf8;
264 use open qw( :utf8 :std );
265 use warnings;
266 package 팣칵ぇ;
267 $ㄒ = 0;
268 if ($ㄒ) {
269     print "1\n";
270 } elsif (!$ㄒ) {
271     $ㄒ++;
272     print $ʎ;
273 } else {
274     print "0\n";
275 }
276 EXPECT
277 Name "팣칵ぇ::ʎ" used only once: possible typo at - line 11.
278 Use of uninitialized value $팣칵ぇ::ʎ in print at - line 11.