File Coverage

inc/My/Module/Build.pm
Criterion Covered Total %
statement 16 55 29.0
branch 0 12 0.0
condition n/a
subroutine 5 10 50.0
pod 0 6 0.0
total 21 83 25.3


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