This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More warnings tests.
[perl5.git] / t / lib / warnings / perl
1   perl.c        AOK
2
3   gv_check(defstash)
4         Name \"%s::%s\" used only once: possible typo 
5
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
16
17 __END__
18 # perl.c
19 no warnings 'once' ;
20 $x = 3 ;
21 use warnings 'once' ;
22 $z = 3 ;
23 EXPECT
24 Name "main::z" used only once: possible typo at - line 5.
25 ########
26 -w
27 # perl.c
28 $x = 3 ;
29 no warnings 'once' ;
30 $z = 3 
31 EXPECT
32 Name "main::x" used only once: possible typo at - line 3.
33 ########
34 # perl.c
35 BEGIN { $^W =1 ; }
36 $x = 3 ;
37 no warnings 'once' ;
38 $z = 3 
39 EXPECT
40 Name "main::x" used only once: possible typo at - line 3.
41 ########
42 -W
43 # perl.c
44 no warnings 'once' ;
45 $x = 3 ;
46 use warnings 'once' ;
47 $z = 3 ;
48 EXPECT
49 OPTION random
50 Name "main::z" used only once: possible typo at - line 6.
51 Name "main::x" used only once: possible typo at - line 4.
52 ########
53 -X
54 # perl.c
55 use warnings 'once' ;
56 $x = 3 ;
57 EXPECT
58 ########
59
60 # perl.c
61 { use warnings 'once' ; $x = 3 ; }
62 $y = 3 ;
63 EXPECT
64 Name "main::x" used only once: possible typo at - line 3.
65 ########
66
67 # perl.c
68 $z = 3 ;
69 BEGIN { $^W = 1 }
70 { no warnings 'once' ; $x = 3 ; }
71 $y = 3 ;
72 EXPECT
73 Name "main::y" used only once: possible typo at - line 6.
74 ########
75
76 # perl.c
77 use utf8;
78 use open qw( :utf8 :std );
79 no warnings 'once' ;
80 $ᛪ = 3 ;
81 use warnings 'once' ;
82 $ȥ = 3 ;
83 EXPECT
84 Name "main::ȥ" used only once: possible typo at - line 8.
85 ########
86 -w
87 # perl.c
88 use utf8;
89 use open qw( :utf8 :std );
90 $ᛪ = 3 ;
91 no warnings 'once' ;
92 $ȥ = 3;
93 EXPECT
94 Name "main::ᛪ" used only once: possible typo at - line 5.
95 ########
96 # perl.c
97 use utf8;
98 use open qw( :utf8 :std );
99 BEGIN { $^W =1 ; }
100 $ᛪ = 3 ;
101 no warnings 'once' ;
102 $ȥ = 3 
103 EXPECT
104 Name "main::ᛪ" used only once: possible typo at - line 5.
105 ########
106 -W
107 # perl.c
108 use utf8;
109 use open qw( :utf8 :std );
110 no warnings 'once' ;
111 $ᛪ = 3 ;
112 use warnings 'once' ;
113 $ȥ = 3 ;
114 EXPECT
115 OPTION random
116 Name "main::ȥ" used only once: possible typo at - line 8.
117 Name "main::ᛪ" used only once: possible typo at - line 6.
118 ########
119 -X
120 # perl.c
121 use utf8;
122 use open qw( :utf8 :std );
123 use warnings 'once' ;
124 $ᛪ = 3 ;
125 EXPECT
126 ########
127
128 # perl.c
129 use utf8;
130 use open qw( :utf8 :std );
131 { use warnings 'once' ; $ᛪ = 3 ; }
132 $ŷ = 3 ;
133 EXPECT
134 Name "main::ᛪ" used only once: possible typo at - line 5.
135 ########
136
137 # perl.c
138 use utf8;
139 use open qw( :utf8 :std );
140 $ȥ = 3 ;
141 BEGIN { $^W = 1 }
142 { no warnings 'once' ; $ᛪ = 3 ; }
143 $ŷ = 3 ;
144 EXPECT
145 Name "main::ŷ" used only once: possible typo at - line 8.
146 ########
147
148
149 # perl.c
150 use utf8;
151 use open qw( :utf8 :std );
152 package ɕლȃṢȿ;
153 no warnings 'once' ;
154 $ᛪ = 3 ;
155 use warnings 'once' ;
156 $ȥ = 3 ;
157 EXPECT
158 Name "ɕლȃṢȿ::ȥ" used only once: possible typo at - line 10.
159 ########
160 -w
161 # perl.c
162 use utf8;
163 use open qw( :utf8 :std );
164 package ɕლȃṢȿ;
165 $ᛪ = 3 ;
166 no warnings 'once' ;
167 $ȥ = 3 
168 EXPECT
169 Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
170 ########
171 # perl.c
172 use utf8;
173 use open qw( :utf8 :std );
174 package ɕლȃṢȿ;
175 BEGIN { $^W =1 ; }
176 $ᛪ = 3 ;
177 no warnings 'once' ;
178 $ȥ = 3 
179 EXPECT
180 Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
181 ########
182 -W
183 # perl.c
184 use utf8;
185 use open qw( :utf8 :std );
186 package ɕლȃṢȿ;
187 no warnings 'once' ;
188 $ᛪ = 3 ;
189 use warnings 'once' ;
190 $ȥ = 3 ;
191 EXPECT
192 OPTION random
193 Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 7.
194 Name "ɕლȃṢȿ::ȥ" used only once: possible typo at - line 9.
195 ########
196 -X
197 # perl.c
198 use utf8;
199 use open qw( :utf8 :std );
200 use warnings 'once' ;
201 package ɕლȃṢȿ;
202 $ᛪ = 3 ;
203 EXPECT
204 ########
205
206 # perl.c
207 use utf8;
208 use open qw( :utf8 :std );
209 package ɕლȃṢȿ;
210 { use warnings 'once' ; $ᛪ = 3 ; }
211 $ŷ = 3 ;
212 EXPECT
213 Name "ɕლȃṢȿ::ᛪ" used only once: possible typo at - line 6.
214 ########
215
216 # perl.c
217 use utf8;
218 use open qw( :utf8 :std );
219 package ɕლȃṢȿ;
220 $ȥ = 3 ;
221 BEGIN { $^W = 1 }
222 { no warnings 'once' ; $ᛪ = 3 ; }
223 $ŷ = 3 ;
224 EXPECT
225 Name "ɕლȃṢȿ::ŷ" used only once: possible typo at - line 9.