File Coverage

inc/My/Module/Build.pm
Criterion Covered Total %
statement 19 58 32.7
branch 0 12 0.0
condition n/a
subroutine 6 11 54.5
pod 0 6 0.0
total 25 87 28.7


line stmt bran cond sub pod time code
1             package My::Module::Build;
2              
3 1     1   5 use strict;
  1         2  
  1         35  
4 1     1   3 use warnings;
  1         10  
  1         60  
5              
6 1     1   494 use Module::Build;
  1         82961  
  1         58  
7             our @ISA = qw{ Module::Build };
8              
9 1     1   7 use Carp;
  1         1  
  1         85  
10             # use lib 'inc'; # Already done because this module is running.
11 1     1   355 use My::Module::Recommend;
  1         2  
  1         462  
12              
13             sub ACTION_authortest {
14             ## my ( $self, @args ) = @_; # Arguments unused
15 0     0 0 0 my ( $self ) = @_;
16              
17 0         0 $self->depends_on( qw{ functional_test optionals_test structural_test } );
18              
19 0         0 return;
20             }
21              
22             sub ACTION_functional_test {
23 0     0 0 0 my ( $self ) = @_;
24              
25 0         0 local $ENV{AUTHOR_TESTING} = 1;
26              
27 0         0 $self->my_depends_on();
28              
29 0         0 print <<'EOD';
30              
31             functional_test
32             AUTHOR_TESTING=1
33             EOD
34              
35             # Not depends_on(), because that is idempotent. But we really do
36             # want to run 'test' more than once if we do more than one of the
37             # *_test actions.
38 0         0 $self->dispatch( 'test' );
39              
40 0         0 return;
41             }
42              
43             sub ACTION_optionals_test {
44 0     0 0 0 my ( $self ) = @_;
45              
46 0         0 my $optionals = join ',', My::Module::Recommend->optionals();
47 0         0 local $ENV{AUTHOR_TESTING} = 1;
48 0         0 local $ENV{PERL5OPT} = "-MTest::Without::Module=$optionals";
49              
50 0         0 $self->my_depends_on();
51              
52 0         0 print <<"EOD";
53              
54             optionals_test
55             AUTHOR_TESTING=1
56             PERL5OPT=-MTest::Without::Module=$optionals
57             EOD
58              
59             # Not depends_on(), because that is idempotent. But we really do
60             # want to run 'test' more than once if we do more than one of the
61             # *_test actions.
62 0         0 $self->dispatch( 'test' );
63              
64 0         0 return;
65             }
66              
67             sub ACTION_structural_test {
68 0     0 0 0 my ( $self ) = @_;
69              
70 0         0 local $ENV{AUTHOR_TESTING} = 1;
71              
72 0         0 $self->my_depends_on();
73              
74 0         0 print <<'EOD';
75              
76             structural_test
77             AUTHOR_TESTING=1
78             EOD
79              
80 0         0 my $structural_test_files = 'xt/author';
81 0 0       0 if ( $self->can( 'args' ) ) {
82 0         0 my @arg = $self->args();
83 0         0 for ( my $inx = 0; $inx < $#arg; $inx += 2 ) {
84 0 0       0 $arg[$inx] =~ m/ \A structural[-_]test[-_]files \z /smx
85             or next;
86 0         0 $structural_test_files = $arg[ $inx + 1 ];
87 0         0 last;
88             }
89             }
90 0         0 $self->test_files( $structural_test_files );
91              
92             # Not depends_on(), because that is idempotent. But we really do
93             # want to run 'test' more than once if we do more than one of the
94             # *_test actions.
95 0         0 $self->dispatch( 'test' );
96              
97 0         0 return;
98             }
99              
100             sub my_depends_on {
101 0     0 0 0 my ( $self ) = @_;
102 0         0 my @depends_on;
103 0 0       0 -d 'blib'
104             or push @depends_on, 'build';
105 0 0       0 -e 'META.json'
106             or push @depends_on, 'distmeta';
107             @depends_on
108 0 0       0 and $self->depends_on( @depends_on );
109 0         0 return;
110             }
111              
112             sub harness_switches {
113 1     1 0 55542 my ( $self ) = @_;
114 1         13 my @res = $self->SUPER::harness_switches();
115 1         58 foreach ( @res ) {
116 0 0       0 '-MDevel::Cover' eq $_
117             or next;
118 0         0 $_ .= '=-db,cover_db,-ignore,inc/';
119             }
120 1         6 return @res;
121             }
122              
123             1;
124              
125             __END__