This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlapi: Fix grammar
[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)
7bb33634
FC
50@DB::args
51EXPECT
52########
53-w
54# perl.c
55print # avoid void warning
56$\, # test a few
57$:, # punct vars
58$0, # and
59$123, # numbers
60$_, # and
61$_foo, # underscores (none of which should warn)
62@DB::args
63if 0;
0d974c9d
FC
64EXPECT
65########
0453d815
PM
66-W
67# perl.c
4438c4b7 68no warnings 'once' ;
0453d815 69$x = 3 ;
4438c4b7 70use warnings 'once' ;
0453d815
PM
71$z = 3 ;
72EXPECT
247c8d76 73OPTION random
0453d815 74Name "main::z" used only once: possible typo at - line 6.
a6fe520e 75Name "main::x" used only once: possible typo at - line 4.
0453d815
PM
76########
77-X
78# perl.c
4438c4b7 79use warnings 'once' ;
0453d815
PM
80$x = 3 ;
81EXPECT
7272584d 82########
0453d815 83
7272584d
PM
84# perl.c
85{ use warnings 'once' ; $x = 3 ; }
86$y = 3 ;
87EXPECT
88Name "main::x" used only once: possible typo at - line 3.
89########
90
91# perl.c
92$z = 3 ;
93BEGIN { $^W = 1 }
94{ no warnings 'once' ; $x = 3 ; }
95$y = 3 ;
96EXPECT
97Name "main::y" used only once: possible typo at - line 6.
012bcf7e
BF
98########
99
100# perl.c
101use utf8;
102use open qw( :utf8 :std );
103no warnings 'once' ;
104$ᛪ = 3 ;
105use warnings 'once' ;
106$ȥ = 3 ;
107EXPECT
108Name "main::ȥ" used only once: possible typo at - line 8.
109########
110-w
111# perl.c
112use utf8;
113use open qw( :utf8 :std );
114$ᛪ = 3 ;
115no warnings 'once' ;
116$ȥ = 3;
117EXPECT
118Name "main::ᛪ" used only once: possible typo at - line 5.
119########
120# perl.c
121use utf8;
122use open qw( :utf8 :std );
123BEGIN { $^W =1 ; }
124$ᛪ = 3 ;
125no warnings 'once' ;
126$ȥ = 3
127EXPECT
128Name "main::ᛪ" used only once: possible typo at - line 5.
129########
130-W
131# perl.c
132use utf8;
133use open qw( :utf8 :std );
134no warnings 'once' ;
135$ᛪ = 3 ;
136use warnings 'once' ;
137$ȥ = 3 ;
138EXPECT
139OPTION random
140Name "main::ȥ" used only once: possible typo at - line 8.
141Name "main::ᛪ" used only once: possible typo at - line 6.
142########
143-X
144# perl.c
145use utf8;
146use open qw( :utf8 :std );
147use warnings 'once' ;
148$ᛪ = 3 ;
149EXPECT
150########
151
152# perl.c
153use utf8;
154use open qw( :utf8 :std );
155{ use warnings 'once' ; $ᛪ = 3 ; }
156$ŷ = 3 ;
157EXPECT
158Name "main::ᛪ" used only once: possible typo at - line 5.
159########
160
161# perl.c
162use utf8;
163use open qw( :utf8 :std );
164$ȥ = 3 ;
165BEGIN { $^W = 1 }
166{ no warnings 'once' ; $ᛪ = 3 ; }
167$ŷ = 3 ;
168EXPECT
169Name "main::ŷ" used only once: possible typo at - line 8.
170########
171
172
173# perl.c
174use utf8;
175use open qw( :utf8 :std );
176package ɕლȃṢȿ;
177no warnings 'once' ;
178$ᛪ = 3 ;
179use warnings 'once' ;
180$ȥ = 3 ;
181EXPECT
182Name "ɕლȃṢȿ::ȥ" used only once: possible typo at - line 10.
183########
184-w
185# perl.c
186use utf8;
187use open qw( :utf8 :std );
188package ɕლȃṢȿ;
189$ᛪ = 3 ;
190no warnings 'once' ;
191$ȥ = 3
192EXPECT
193Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
194########
195# perl.c
196use utf8;
197use open qw( :utf8 :std );
198package ɕლȃṢȿ;
199BEGIN { $^W =1 ; }
200$ᛪ = 3 ;
201no warnings 'once' ;
202$ȥ = 3
203EXPECT
204Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
205########
206-W
207# perl.c
208use utf8;
209use open qw( :utf8 :std );
210package ɕლȃṢȿ;
211no warnings 'once' ;
212$ᛪ = 3 ;
213use warnings 'once' ;
214$ȥ = 3 ;
215EXPECT
216OPTION random
217Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 7.
218Name "ɕლȃṢȿ::ȥ" used only once: possible typo at - line 9.
219########
220-X
221# perl.c
222use utf8;
223use open qw( :utf8 :std );
224use warnings 'once' ;
225package ɕლȃṢȿ;
226$ᛪ = 3 ;
227EXPECT
228########
229
230# perl.c
231use utf8;
232use open qw( :utf8 :std );
233package ɕლȃṢȿ;
234{ use warnings 'once' ; $ᛪ = 3 ; }
235$ŷ = 3 ;
236EXPECT
237Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
238########
239
240# perl.c
241use utf8;
242use open qw( :utf8 :std );
243package ɕლȃṢȿ;
244$ȥ = 3 ;
245BEGIN { $^W = 1 }
246{ no warnings 'once' ; $ᛪ = 3 ; }
247$ŷ = 3 ;
248EXPECT
249Name "ɕლȃṢȿ::ŷ" used only once: possible typo at - line 9.
a73ef99b
FC
250########
251
252use warnings 'once';
253$foo++; BEGIN { eval q|@a =~ s///; sub foo;| }
254EXPECT
255Name "main::foo" used only once: possible typo at - line 3.
6b352265
FC
256########
257
258use warnings 'once';
259BEGIN { ${"_<".__FILE__} = \1 } # should not affect file name in warning
260$foo++;
261EXPECT
262Name "main::foo" used only once: possible typo at - line 4.
51da40ed
FC
263########
264
265use warnings 'once'; # necessary to trigger the crash
266BEGIN{*MUSHROOMS::mushrooms::MUSHROOMS:: = *MUSHROOMS::} # circularity
267$foo++;
268EXPECT
269Name "main::foo" used only once: possible typo at - line 4.