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