t/00-compile.t

filter: Statementstmt 67.2% 37 / 55 Branchbran 35.7% 5 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod n/a totaltotal 63.2% 50 / 79 CC 5 SCAR 18.9
CC
5
Cov
61%
__ANON__
20.0
__ANON__
2.0
_find_scripts
2.0
CRAP 6.6
« blib/lib/Dist/Zilla/PluginBundle/LOGIE.pm ↑ Summary Dist-Zilla-PluginBundle-LOGIE-0.01/t/release-eol.t »
1 #!perl
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9  
10 4 ▶use File::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use File::Temp qw{ tempdir };
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 my @modules;
14 find(
15 20 ▶ sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
16 20 ▶ return if $File::Find::name !~ /\.pm\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $File::Find::name =~ /\.pm\z/ 16 4 20
17 4 my $found = $File::Find::name;
18 4 $found =~ s{^lib/}{};
19 4 $found =~ s{[/\\]}{::}g;
20 4 $found =~ s/\.pm$//;
21 # nothing to skip
22 4 push @modules, $found;
23 },
24 4 'lib',
25 );
26  
27 0 ▶sub _find_scripts {
Subroutine _find_scripts: not called CC=1 SCAR=6.9
28 0 my $dir = shift @_;
29  
30 0 my @found_scripts = ();
31 find(
32 0 ▶ sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
33 0 ▶ return unless -f;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $_ 0 0 0
34 0 my $found = $File::Find::name;
35 # nothing to skip
36 0 ▶ open my $FH, '<', $_ or do {
Branch: 1 branch
BranchTrueFalseTotal
open my $FH, "<", $_ or do { note("Unable to open $found in ( $! ), skipping"); return } 0 0 0
37 0 note( "Unable to open $found in ( $! ), skipping" );
38 0 return;
39 };
40 0 my $shebang = <$FH>;
41 0 ▶ return unless $shebang =~ /^#!.*?\bperl\b\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $shebang =~ /^#!.*?\bperl\b\s*$/ 0 0 0
42 0 push @found_scripts, $found;
43 },
44 0 $dir,
45 );
46  
47 0 return @found_scripts;
48 }
49  
50 4 my @scripts;
51 12 ▶do { push @scripts, _find_scripts($_) if -d $_ }
Branch: 1 branch
BranchTrueFalseTotal
if -d $_ 0 12 12
52 4 for qw{ bin script scripts };
53  
54 4 my $plan = scalar(@modules) + scalar(@scripts);
55 4 ▶$plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
Branch: 1 branch
BranchTrueFalseTotal
$plan ? : 4 0 4
56  
57 {
58 # fake home for cpan-testers
59 # no fake requested ## local $ENV{HOME} = tempdir( CLEANUP => 1 );
60  
61 4 like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" )
62 4 for sort @modules;
63  
64 SKIP: {
65 0 ▶ eval "use Test::Script 1.05; 1;";
Subroutine BEGIN: called CC=1 SCAR=0.6
66 4 ▶ skip "Test::Script needed to test script compilation", scalar(@scripts) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 4 0 4
67 0 foreach my $file ( @scripts ) {
68 0 my $script = $file;
69 0 $script =~ s!.*/!!;
70 0 script_compiles( $file, "$script script compiles" );
71 }
72 }
73 }
« blib/lib/Dist/Zilla/PluginBundle/LOGIE.pm ↑ Summary Dist-Zilla-PluginBundle-LOGIE-0.01/t/release-eol.t »