LocalFunctions/Receptor.pm

filter: Statementstmt 97.6% 42 / 43 Branchbran 83.3% 10 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 92.1% 59 / 64 CC 9 SCAR 11.4
CC
9
Cov
95%
_list_modules_in_manifest
5.0
_test_local_functions
3.0
all_local_functions_ok
3.0
CRAP 3.1
↑ Summary LocalFunctions/Fast.pm »
1 package Test::LocalFunctions::Receptor;
2  
3 48 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 48 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 48 ▶use ExtUtils::Manifest qw/maniread/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 20 ▶sub all_local_functions_ok {
Subroutine all_local_functions_ok: called CC=3 SCAR=11.0
Pod undocumented
8 20 my ( $backend, $args ) = @_;
9  
10 20 my $builder = $backend->builder;
11 20 my @libs = _list_modules_in_manifest($builder, $args->{ignore_modules});
12  
13 20 $builder->plan( tests => scalar @libs );
14  
15 20 my $fail = 0;
16 20 for my $lib (@libs) {
17 62 ▶ _test_local_functions( $backend, $builder, $lib, $args ) or $fail++;
Branch: 1 branch
BranchTrueFalseTotal
_test_local_functions($backend, $builder, $lib, $args) or ++$fail 45 1 46
18 }
19 4 return $fail == 0;
20 }
21  
22 37 ▶sub local_functions_ok {
Subroutine local_functions_ok: called CC=1 SCAR=0.0
Pod undocumented
23 37 my ( $backend, $lib, $args ) = @_;
24 37 return _test_local_functions( $backend, $backend->builder, $lib, $args );
25 }
26  
27 99 ▶sub _test_local_functions {
Subroutine _test_local_functions: called CC=3 SCAR=11.0
28 99 my ( $caller, $builder, $file, $args ) = @_;
29  
30 99 local $Test::Builder::Level = $Test::Builder::Level + 1;
31  
32 99 ▶ my $pid; $pid = fork or do {
Branch: 1 branch
BranchTrueFalseTotal
$pid = fork or do { defined $pid ? exit $caller->is_in_use($builder, $file, $args) : die("failed forking: $!") } 69 30 99
33 30 ▶ defined $pid ? exit $caller->is_in_use( $builder, $file, $args )
Branch: 1 branch
BranchTrueFalseTotal
defined $pid ? : 30 0 30
34 : die "failed forking: $!"
35 };
36 69 wait;
37 69 return $builder->ok( $? == 0, $file );
38 }
39  
40 20 ▶sub _list_modules_in_manifest {
Subroutine _list_modules_in_manifest: called CC=5 SCAR=16.1
41 20 my ( $builder, $ignores ) = @_;
42  
43 20 ▶ if ( not -f $ExtUtils::Manifest::MANIFEST ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $ExtUtils::Manifest::MANIFEST) 0 20 20
44 0 $builder->plan( skip_all => "$ExtUtils::Manifest::MANIFEST doesn't exist" );
45 }
46 20 my $manifest = maniread();
47 20 my @libs = grep { m!\Alib/.*\.pm\Z! } keys %{$manifest};
48  
49 20 for my $ignore (@$ignores) {
50 6 $ignore =~ s!::!/!g;
51 6 $ignore =~ /\.pm\Z/;
52 6 ▶ $ignore .= '.pm' if $& ne '.pm';
Branch: 1 branch
BranchTrueFalseTotal
if $& ne ".pm" 2 4 6
53 6 $ignore =~ m!\Alib/!;
54 6 ▶ $ignore = "lib/$ignore" if $& ne 'lib/';
Branch: 1 branch
BranchTrueFalseTotal
if $& ne "lib/" 4 2 6
55 6 @libs = grep { $_ ne $ignore } @libs;
56 }
57 20 return @libs;
58 }
59 48 1;
↑ Summary LocalFunctions/Fast.pm »