File Coverage

blib/lib/Dist/Zilla/App/Command/test.pm
Criterion Covered Total %
statement 6 14 42.8
branch 0 14 0.0
condition 0 12 0.0
subroutine 2 5 40.0
pod 3 3 100.0
total 11 48 22.9


line stmt bran cond sub pod time code
1             # ABSTRACT: test your dist
2              
3             use Dist::Zilla::Pragmas;
4 4     4   2551  
  4         11  
  4         23  
5             use Dist::Zilla::App -command;
6 4     4   35  
  4         9  
  4         27  
7             #pod =head1 SYNOPSIS
8             #pod
9             #pod dzil test [ --release ] [ --no-author ] [ --automated ] [ --extended ] [ --all ]
10             #pod
11             #pod =head1 DESCRIPTION
12             #pod
13             #pod This command is a thin wrapper around the L<test|Dist::Zilla::Dist::Builder/test> method in
14             #pod Dist::Zilla. It builds your dist and runs the tests with the AUTHOR_TESTING
15             #pod environment variable turned on, so it's like doing this:
16             #pod
17             #pod export AUTHOR_TESTING=1
18             #pod dzil build --no-tgz
19             #pod cd $BUILD_DIRECTORY
20             #pod perl Makefile.PL
21             #pod make
22             #pod make test
23             #pod
24             #pod A build that fails tests will be left behind for analysis, and F<dzil> will
25             #pod exit a non-zero value. If the tests are successful, the build directory will
26             #pod be removed and F<dzil> will exit with status 0.
27             #pod
28             #pod =cut
29              
30             [ 'release' => 'enables the RELEASE_TESTING env variable', { default => 0 } ],
31             [ 'automated' => 'enables the AUTOMATED_TESTING env variable', { default => 0 } ],
32 0     0 1   [ 'extended' => 'enables the EXTENDED_TESTING env variable', { default => 0 } ],
33             [ 'author!' => 'enables the AUTHOR_TESTING env variable (default behavior)', { default => 1 } ],
34             [ 'all' => 'enables the RELEASE_TESTING, AUTOMATED_TESTING, EXTENDED_TESTING and AUTHOR_TESTING env variables', { default => 0 } ],
35             [ 'keep-build-dir|keep' => 'keep the build directory even after a success' ],
36             [ 'jobs|j=i' => 'number of parallel test jobs to run' ],
37             [ 'test-verbose' => 'enables verbose testing (TEST_VERBOSE env variable on Makefile.PL, --verbose on Build.PL', { default => 0 } ],
38             }
39              
40             #pod =head1 OPTIONS
41             #pod
42             #pod =head2 --release
43             #pod
44             #pod This will run the test suite with RELEASE_TESTING=1
45             #pod
46             #pod =head2 --automated
47             #pod
48             #pod This will run the test suite with AUTOMATED_TESTING=1
49             #pod
50             #pod =head2 --extended
51             #pod
52             #pod This will run the test suite with EXTENDED_TESTING=1
53             #pod
54             #pod =head2 --no-author
55             #pod
56             #pod This will run the test suite without setting AUTHOR_TESTING
57             #pod
58             #pod =head2 --all
59             #pod
60             #pod Equivalent to --release --automated --extended --author
61             #pod
62             #pod =cut
63              
64              
65             my ($self, $opt, $arg) = @_;
66 0     0 1    
67             local $ENV{RELEASE_TESTING} = 1 if $opt->release or $opt->all;
68             local $ENV{AUTHOR_TESTING} = 1 if $opt->author or $opt->all;
69 0     0 1   local $ENV{AUTOMATED_TESTING} = 1 if $opt->automated or $opt->all;
70             local $ENV{EXTENDED_TESTING} = 1 if $opt->extended or $opt->all;
71 0 0 0        
72 0 0 0       $self->zilla->test({
73 0 0 0       $opt->keep_build_dir
74 0 0 0       ? (keep_build_dir => 1)
75             : (),
76 0 0         $opt->jobs
    0          
    0          
77             ? (jobs => $opt->jobs)
78             : (),
79             $opt->test_verbose
80             ? (test_verbose => $opt->test_verbose)
81             : (),
82             });
83             }
84              
85             1;
86              
87              
88             =pod
89              
90             =encoding UTF-8
91              
92             =head1 NAME
93              
94             Dist::Zilla::App::Command::test - test your dist
95              
96             =head1 VERSION
97              
98             version 6.028
99              
100             =head1 SYNOPSIS
101              
102             dzil test [ --release ] [ --no-author ] [ --automated ] [ --extended ] [ --all ]
103              
104             =head1 DESCRIPTION
105              
106             This command is a thin wrapper around the L<test|Dist::Zilla::Dist::Builder/test> method in
107             Dist::Zilla. It builds your dist and runs the tests with the AUTHOR_TESTING
108             environment variable turned on, so it's like doing this:
109              
110             export AUTHOR_TESTING=1
111             dzil build --no-tgz
112             cd $BUILD_DIRECTORY
113             perl Makefile.PL
114             make
115             make test
116              
117             A build that fails tests will be left behind for analysis, and F<dzil> will
118             exit a non-zero value. If the tests are successful, the build directory will
119             be removed and F<dzil> will exit with status 0.
120              
121             =head1 PERL VERSION
122              
123             This module should work on any version of perl still receiving updates from
124             the Perl 5 Porters. This means it should work on any version of perl released
125             in the last two to three years. (That is, if the most recently released
126             version is v5.40, then this module should work on both v5.40 and v5.38.)
127              
128             Although it may work on older versions of perl, no guarantee is made that the
129             minimum required version will not be increased. The version may be increased
130             for any reason, and there is no promise that patches will be accepted to lower
131             the minimum required perl.
132              
133             =head1 OPTIONS
134              
135             =head2 --release
136              
137             This will run the test suite with RELEASE_TESTING=1
138              
139             =head2 --automated
140              
141             This will run the test suite with AUTOMATED_TESTING=1
142              
143             =head2 --extended
144              
145             This will run the test suite with EXTENDED_TESTING=1
146              
147             =head2 --no-author
148              
149             This will run the test suite without setting AUTHOR_TESTING
150              
151             =head2 --all
152              
153             Equivalent to --release --automated --extended --author
154              
155             =head1 AUTHOR
156              
157             Ricardo SIGNES 😏 <cpan@semiotic.systems>
158              
159             =head1 COPYRIGHT AND LICENSE
160              
161             This software is copyright (c) 2022 by Ricardo SIGNES.
162              
163             This is free software; you can redistribute it and/or modify it under
164             the same terms as the Perl 5 programming language system itself.
165              
166             =cut