File Coverage

inc/My/Module/Build.pm
Criterion Covered Total %
statement 21 59 35.5
branch 1 12 8.3
condition n/a
subroutine 7 12 58.3
pod 0 6 0.0
total 29 89 32.5


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