File Coverage

inc/My/Module/Build.pm
Criterion Covered Total %
statement 18 55 32.7
branch 0 10 0.0
condition n/a
subroutine 6 11 54.5
pod 0 5 0.0
total 24 81 29.6


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