This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Preserve 64-bit array offsets in uninit warnings
[perl5.git] / t / lib / warnings / perl
CommitLineData
599cee73
PM
1 perl.c AOK
2
3 gv_check(defstash)
4 Name \"%s::%s\" used only once: possible typo
5
0453d815
PM
6 Mandatory Warnings All TODO
7 ------------------
8 Recompile perl with -DDEBUGGING to use -D switch [moreswitches]
9 Unbalanced scopes: %ld more ENTERs than LEAVEs [perl_destruct]
10 Unbalanced saves: %ld more saves than restores [perl_destruct]
11 Unbalanced tmps: %ld more allocs than frees [perl_destruct]
12 Unbalanced context: %ld more PUSHes than POPs [perl_destruct]
13 Unbalanced string table refcount: (%d) for \"%s\" [perl_destruct]
14 Scalars leaked: %ld [perl_destruct]
15
599cee73
PM
16
17__END__
18# perl.c
4438c4b7 19no warnings 'once' ;
0453d815 20$x = 3 ;
4438c4b7 21use warnings 'once' ;
0453d815
PM
22$z = 3 ;
23EXPECT
24Name "main::z" used only once: possible typo at - line 5.
25########
26-w
27# perl.c
599cee73 28$x = 3 ;
4438c4b7 29no warnings 'once' ;
0453d815 30$z = 3
599cee73
PM
31EXPECT
32Name "main::x" used only once: possible typo at - line 3.
0453d815
PM
33########
34# perl.c
35BEGIN { $^W =1 ; }
36$x = 3 ;
4438c4b7 37no warnings 'once' ;
0453d815
PM
38$z = 3
39EXPECT
40Name "main::x" used only once: possible typo at - line 3.
41########
0d974c9d
FC
42# perl.c
43use warnings 'once';
44$\; # test a few
45$:; # punct vars
46$0; # and
47$123; # numbers
48$_; # and
49$_foo; # underscores (none of which should warn)
50EXPECT
51########
0453d815
PM
52-W
53# perl.c
4438c4b7 54no warnings 'once' ;
0453d815 55$x = 3 ;
4438c4b7 56use warnings 'once' ;
0453d815
PM
57$z = 3 ;
58EXPECT
247c8d76 59OPTION random
0453d815 60Name "main::z" used only once: possible typo at - line 6.
a6fe520e 61Name "main::x" used only once: possible typo at - line 4.
0453d815
PM
62########
63-X
64# perl.c
4438c4b7 65use warnings 'once' ;
0453d815
PM
66$x = 3 ;
67EXPECT
7272584d 68########
0453d815 69
7272584d
PM
70# perl.c
71{ use warnings 'once' ; $x = 3 ; }
72$y = 3 ;
73EXPECT
74Name "main::x" used only once: possible typo at - line 3.
75########
76
77# perl.c
78$z = 3 ;
79BEGIN { $^W = 1 }
80{ no warnings 'once' ; $x = 3 ; }
81$y = 3 ;
82EXPECT
83Name "main::y" used only once: possible typo at - line 6.
012bcf7e
BF
84########
85
86# perl.c
87use utf8;
88use open qw( :utf8 :std );
89no warnings 'once' ;
90$ᛪ = 3 ;
91use warnings 'once' ;
92$ȥ = 3 ;
93EXPECT
94Name "main::ȥ" used only once: possible typo at - line 8.
95########
96-w
97# perl.c
98use utf8;
99use open qw( :utf8 :std );
100$ᛪ = 3 ;
101no warnings 'once' ;
102$ȥ = 3;
103EXPECT
104Name "main::ᛪ" used only once: possible typo at - line 5.
105########
106# perl.c
107use utf8;
108use open qw( :utf8 :std );
109BEGIN { $^W =1 ; }
110$ᛪ = 3 ;
111no warnings 'once' ;
112$ȥ = 3
113EXPECT
114Name "main::ᛪ" used only once: possible typo at - line 5.
115########
116-W
117# perl.c
118use utf8;
119use open qw( :utf8 :std );
120no warnings 'once' ;
121$ᛪ = 3 ;
122use warnings 'once' ;
123$ȥ = 3 ;
124EXPECT
125OPTION random
126Name "main::ȥ" used only once: possible typo at - line 8.
127Name "main::ᛪ" used only once: possible typo at - line 6.
128########
129-X
130# perl.c
131use utf8;
132use open qw( :utf8 :std );
133use warnings 'once' ;
134$ᛪ = 3 ;
135EXPECT
136########
137
138# perl.c
139use utf8;
140use open qw( :utf8 :std );
141{ use warnings 'once' ; $ᛪ = 3 ; }
142$ŷ = 3 ;
143EXPECT
144Name "main::ᛪ" used only once: possible typo at - line 5.
145########
146
147# perl.c
148use utf8;
149use open qw( :utf8 :std );
150$ȥ = 3 ;
151BEGIN { $^W = 1 }
152{ no warnings 'once' ; $ᛪ = 3 ; }
153$ŷ = 3 ;
154EXPECT
155Name "main::ŷ" used only once: possible typo at - line 8.
156########
157
158
159# perl.c
160use utf8;
161use open qw( :utf8 :std );
162package ɕლȃṢȿ;
163no warnings 'once' ;
164$ᛪ = 3 ;
165use warnings 'once' ;
166$ȥ = 3 ;
167EXPECT
168Name "ɕლȃṢȿ::ȥ" used only once: possible typo at - line 10.
169########
170-w
171# perl.c
172use utf8;
173use open qw( :utf8 :std );
174package ɕლȃṢȿ;
175$ᛪ = 3 ;
176no warnings 'once' ;
177$ȥ = 3
178EXPECT
179Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
180########
181# perl.c
182use utf8;
183use open qw( :utf8 :std );
184package ɕლȃṢȿ;
185BEGIN { $^W =1 ; }
186$ᛪ = 3 ;
187no warnings 'once' ;
188$ȥ = 3
189EXPECT
190Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
191########
192-W
193# perl.c
194use utf8;
195use open qw( :utf8 :std );
196package ɕლȃṢȿ;
197no warnings 'once' ;
198$ᛪ = 3 ;
199use warnings 'once' ;
200$ȥ = 3 ;
201EXPECT
202OPTION random
203Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 7.
204Name "ɕლȃṢȿ::ȥ" used only once: possible typo at - line 9.
205########
206-X
207# perl.c
208use utf8;
209use open qw( :utf8 :std );
210use warnings 'once' ;
211package ɕლȃṢȿ;
212$ᛪ = 3 ;
213EXPECT
214########
215
216# perl.c
217use utf8;
218use open qw( :utf8 :std );
219package ɕლȃṢȿ;
220{ use warnings 'once' ; $ᛪ = 3 ; }
221$ŷ = 3 ;
222EXPECT
223Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
224########
225
226# perl.c
227use utf8;
228use open qw( :utf8 :std );
229package ɕლȃṢȿ;
230$ȥ = 3 ;
231BEGIN { $^W = 1 }
232{ no warnings 'once' ; $ᛪ = 3 ; }
233$ŷ = 3 ;
234EXPECT
235Name "ɕლȃṢȿ::ŷ" used only once: possible typo at - line 9.
a73ef99b
FC
236########
237
238use warnings 'once';
239$foo++; BEGIN { eval q|@a =~ s///; sub foo;| }
240EXPECT
241Name "main::foo" used only once: possible typo at - line 3.
6b352265
FC
242########
243
244use warnings 'once';
245BEGIN { ${"_<".__FILE__} = \1 } # should not affect file name in warning
246$foo++;
247EXPECT
248Name "main::foo" used only once: possible typo at - line 4.
51da40ed
FC
249########
250
251use warnings 'once'; # necessary to trigger the crash
252BEGIN{*MUSHROOMS::mushrooms::MUSHROOMS:: = *MUSHROOMS::} # circularity
253$foo++;
254EXPECT
255Name "main::foo" used only once: possible typo at - line 4.