Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / t / Modules / RequireExplicitPackage.run
1 ## name one statement before package
2 ## failures 1
3 ## cut
4 $foo = $bar;
5 package foo;
6 END_PERL
7
8 $policy = 'Modules::RequireExplicitPackage';
9 is( pcritique($policy, \$code), 1, $policy.' 1 stmnt before package');
10
11 #-----------------------------------------------------------------------------
12
13 ## name BEGIN block before package
14 ## failures 1
15 ## cut
16 BEGIN{
17     print 'Hello';        #this violation will be squelched 
18     print 'Beginning';    #this violation will be squelched 
19 }
20
21 package foo;
22
23 #-----------------------------------------------------------------------------
24
25 ## name inclusion before package
26 ## failures 1
27 ## cut
28 use Some::Module;
29 package foo;
30
31 #-----------------------------------------------------------------------------
32
33 ## name two statements before package
34 ## failures 1
35 ## cut
36 $baz = $nuts;
37 print 'whatever';      #this violation will be squelched 
38 package foo;
39
40 #-----------------------------------------------------------------------------
41
42 ## name no package at all
43 ## failures 1
44 ## cut
45 print 'whatever';
46
47 #-----------------------------------------------------------------------------
48
49 ## name no statements at all
50 ## failures 0
51 ## cut
52
53 # no statements
54
55 #-----------------------------------------------------------------------------
56
57 ## name just a package, no statements
58 ## failures 0
59 ## cut
60 package foo;
61
62 #-----------------------------------------------------------------------------
63
64 ## name package OK
65 ## failures 0
66 ## cut
67 package foo;
68 use strict;
69 $foo = $bar;
70
71 #-----------------------------------------------------------------------------
72
73 ## name programs can be exempt
74 ## failures 0
75 ## parms {exempt_scripts => 1}
76 ## cut
77 #!/usr/bin/perl
78 $foo = $bar;
79 package foo;
80
81 #-----------------------------------------------------------------------------
82
83 ## name programs not exempted
84 ## failures 1
85 ## parms {exempt_scripts => 0}
86 ## cut
87 #!/usr/bin/perl
88 use strict;
89 use warnings;          #this violation will be squelched 
90 my $foo = 42;          #this violation will be squelched 
91
92 #-----------------------------------------------------------------------------
93
94 ## name programs not exempted, but we have a package
95 ## failures 0
96 ## parms {exempt_scripts => 0}
97 ## cut
98 #!/usr/bin/perl
99 package foo;
100 $foo = $bar;
101
102 #-----------------------------------------------------------------------------
103
104 ## name Work around a PPI bug that doesn't return a location for C<({})>.
105 ## failures 1
106 ## cut
107
108 ({})
109