This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The "used only once" warnings (from gv_check) come
[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.