File Coverage

blib/lib/Test/Dist/Zilla/Release.pm
Criterion Covered Total %
statement 34 34 100.0
branch 5 6 83.3
condition 2 3 66.6
subroutine 8 8 100.0
pod n/a
total 49 51 96.0


line stmt bran cond sub pod time code
1             # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2             #
3             # file: lib/Test/Dist/Zilla/Release.pm
4             #
5             # Copyright © 2015 Van de Bugger
6             #
7             # This file is part of perl-Test-Dist-Zilla.
8             #
9             # perl-Test-Dist-Zilla is free software: you can redistribute it and/or modify it under the terms
10             # of the GNU General Public License as published by the Free Software Foundation, either version
11             # 3 of the License, or (at your option) any later version.
12             #
13             # perl-Test-Dist-Zilla is distributed in the hope that it will be useful, but WITHOUT ANY
14             # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15             # PURPOSE. See the GNU General Public License for more details.
16             #
17             # You should have received a copy of the GNU General Public License along with
18             # perl-Test-Dist-Zilla. If not, see <http://www.gnu.org/licenses/>.
19             #
20             # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21              
22             #pod =head1 SYNOPSIS
23             #pod
24             #pod
25             #pod =head1 DESCRIPTION
26             #pod
27             #pod This is a C<Test::Routine>-based role for testing C<Dist::Zilla> and its plugins. It creates
28             #pod F<dist.ini> file with specified content in a temporary directory, populates the directory with
29             #pod specified files, runs "release" command with testing version of C<Dist::Zilla> in the temporary
30             #pod directory, checks actual exception and log messages do match expected ones, and let you write other
31             #pod checks specific for your plugin.
32             #pod
33             #pod =cut
34              
35             package Test::Dist::Zilla::Release;
36              
37 1     1   870 use namespace::autoclean;
  1         2  
  1         11  
38 1     1   72 use strict;
  1         2  
  1         25  
39 1     1   657 use version 0.77;
  1         2021  
  1         6  
40 1     1   59 use warnings;
  1         2  
  1         44  
41              
42             # ABSTRACT: Test your Dist::Zilla plugin in I<build> action
43             our $VERSION = 'v0.4.2'; # VERSION
44              
45 1     1   5 use Test::Routine;
  1         2  
  1         9  
46              
47             with 'Test::Dist::Zilla';
48              
49 1     1   7474 use Test::Deep qw{ cmp_deeply };
  1         1  
  1         9  
50 1     1   116 use Test::More;
  1         3  
  1         13  
51              
52             # --------------------------------------------------------------------------------------------------
53              
54             #pod =method Release
55             #pod
56             #pod =cut
57              
58             test 'Release' => sub {
59              
60 2     2   26631 my ( $self ) = @_;
61 2         89 my $expected = $self->expected;
62              
63 2         10 plan 'no_plan'; # Some checks may be run inside `$self->release()`, I do not know how many.
64              
65 2         60 $self->release();
66 2         12 $self->_anno_text( 'Full log', @{ $self->tzil->log_messages } );
  2         175  
67 2 100       181 if ( $self->exception ) {
68 1         39 $self->_anno_line( 'Exception: ' . $self->exception );
69             };
70              
71 2 100 66     35 if ( exists( $expected->{ exception } ) and defined( $expected->{ exception } ) ) {
72 1         42 cmp_deeply( $self->exception, $expected->{ exception }, 'release must fail' );
73             } else {
74 1         65 is( $self->exception, undef, 'release must pass' );
75             };
76 2 50       1480 if ( exists( $expected->{ messages } ) ) {
77 2         20 cmp_deeply( $self->messages, $expected->{ messages }, 'messages' );
78             };
79              
80             };
81              
82             # --------------------------------------------------------------------------------------------------
83              
84             1;
85              
86             # --------------------------------------------------------------------------------------------------
87              
88             #pod =head1 SEE ALSO
89             #pod
90             #pod =for :list
91             #pod = L<Test::Dist::Zilla>
92             #pod = L<Test::Deep/"$ok = cmp_deeply($got, $expected, $name)">
93             #pod = L<Test::Routine>
94             #pod
95             #pod =head1 COPYRIGHT AND LICENSE
96             #pod
97             #pod Copyright (C) 2015 Van de Bugger
98             #pod
99             #pod License GPLv3+: The GNU General Public License version 3 or later
100             #pod <http://www.gnu.org/licenses/gpl-3.0.txt>.
101             #pod
102             #pod This is free software: you are free to change and redistribute it. There is
103             #pod NO WARRANTY, to the extent permitted by law.
104             #pod
105             #pod
106             #pod =cut
107              
108             # end of file #
109              
110             __END__
111              
112             =pod
113              
114             =encoding UTF-8
115              
116             =head1 NAME
117              
118             Test::Dist::Zilla::Release - Test your Dist::Zilla plugin in I<build> action
119              
120             =head1 VERSION
121              
122             Version v0.4.2, released on 2015-10-31 08:49 UTC.
123              
124             =head1 SYNOPSIS
125              
126             =head1 DESCRIPTION
127              
128             This is a C<Test::Routine>-based role for testing C<Dist::Zilla> and its plugins. It creates
129             F<dist.ini> file with specified content in a temporary directory, populates the directory with
130             specified files, runs "release" command with testing version of C<Dist::Zilla> in the temporary
131             directory, checks actual exception and log messages do match expected ones, and let you write other
132             checks specific for your plugin.
133              
134             =head1 OBJECT METHODS
135              
136             =head2 Release
137              
138             =head1 SEE ALSO
139              
140             =over 4
141              
142             =item L<Test::Dist::Zilla>
143              
144             =item L<Test::Deep/"$ok = cmp_deeply($got, $expected, $name)">
145              
146             =item L<Test::Routine>
147              
148             =back
149              
150             =head1 AUTHOR
151              
152             Van de Bugger <van.de.bugger@gmail.com>
153              
154             =head1 COPYRIGHT AND LICENSE
155              
156             Copyright (C) 2015 Van de Bugger
157              
158             License GPLv3+: The GNU General Public License version 3 or later
159             <http://www.gnu.org/licenses/gpl-3.0.txt>.
160              
161             This is free software: you are free to change and redistribute it. There is
162             NO WARRANTY, to the extent permitted by law.
163              
164             =cut