« blib/lib/Dist/Zilla/App/Command/xtest.pm
↑ Summary
blib/lib/Dist/Zilla/Plugin/CheckExtraTests.pm »
| 1 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||
| 4 | package Dist::Zilla::Plugin::RunExtraTests; | ||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: support running xt tests via dzil test | ||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.029'; | |||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | # Dependencies | ||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Dist::Zilla 4.3 (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Moose 2; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use namespace::autoclean 0.09; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | # extends, roles, attributes, etc. | ||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | 1 | with 'Dist::Zilla::Role::TestRunner'; | |||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | # methods | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 5 | ▶ | sub test { | ||||||||||||||||||||||||||||||
|
Subroutine
test: called CC=15 SCAR=30.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 21 | 5 | my ($self, $target, $arg) = @_; | |||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||
| 23 | 5 | my %dirs; @dirs{ grep { -d } glob('xt/*') } = (); | |||||||||||||||||||||||||||||||
| 24 | 5 | ▶ | delete $dirs{'xt/author'} unless $ENV{AUTHOR_TESTING}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 25 | 5 | ▶ | delete $dirs{'xt/smoke'} unless $ENV{AUTOMATED_TESTING}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 26 | 5 | ▶ | delete $dirs{'xt/release'} unless $ENV{RELEASE_TESTING}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 5 | my @dirs = sort keys %dirs; | |||||||||||||||||||||||||||||||
| 29 | 5 | my @files = grep { -f } glob('xt/*'); | |||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | return unless @dirs or @files; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@dirs or @files
MC/DC100%2/2
@dirs or @files
@dirs
@files
Truth table100%3/3
A or B
A= @dirsB= @files
| |||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | # If the dist hasn't been built yet, then build it: | ||||||||||||||||||||||||||||||||
| 33 | 3 | ▶ | unless ( -d 'blib' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 34 | 0 | my @builders = @{ $self->zilla->plugins_with( -BuildRunner ) }; | |||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | die "no BuildRunner plugins specified" unless @builders; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 36 | 0 | $_->build for @builders; | |||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | die "no blib; failed to build properly?" unless -d 'blib'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | my $jobs = $arg && exists $arg->{jobs} | ||||||||||||||||||||||||||||||||
| 41 | ? $arg->{jobs} | ||||||||||||||||||||||||||||||||
| 42 | 3 | ▶ | : $self->can('default_jobs') | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$arg and exists $arg->{"jobs"}
MC/DC0%0/2
$arg and exists $arg->{"jobs"}
$arg
exists $arg->{"jobs"}
Truth table33%1/3
A and B
A= $argB= exists $arg->{"jobs"}
| |||||||||||||||||||||||||||||||||
| 43 | ? $self->default_jobs | ||||||||||||||||||||||||||||||||
| 44 | : 1; | ||||||||||||||||||||||||||||||||
| 45 | 3 | ▶ | my @v = $self->zilla->logger->get_debug ? ('-v') : (); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 3 | require App::Prove; | |||||||||||||||||||||||||||||||
| 48 | 3 | App::Prove->VERSION('3.00'); | |||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 3 | my $app = App::Prove->new; | |||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | 3 | $self->log_debug([ 'running prove with args: %s', join(' ', '-j', $jobs, @v, qw/-b xt/) ]); | |||||||||||||||||||||||||||||||
| 53 | 3 | $app->process_args( '-j', $jobs, @v, qw/-b xt/); | |||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | 3 | $self->log_debug([ 'running prove with args: %s', join(' ', '-j', $jobs, @v, qw/-r -b/, @dirs) ]); | |||||||||||||||||||||||||||||||
| 56 | 3 | $app->process_args( '-j', $jobs, @v, qw/-r -b/, @dirs ); | |||||||||||||||||||||||||||||||
| 57 | 3 | ▶ | $app->run or $self->log_fatal("Fatal errors in xt tests"); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 58 | 1 | return; | |||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | 1 | 1; | |||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||||||||||||||