line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Class::Moose::CLI; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Use this in your tcm.t script for a drop-in runner tool |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
209374
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
7
|
1
|
|
|
1
|
|
388
|
use namespace::autoclean; |
|
1
|
|
|
|
|
14681
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
63
|
use 5.01000; |
|
1
|
|
|
|
|
3
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.99'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
510
|
use Moose 2.0000; |
|
1
|
|
|
|
|
381514
|
|
|
1
|
|
|
|
|
10
|
|
14
|
1
|
|
|
1
|
|
6470
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
121
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'Test::Class::Moose::Role::CLI'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__END__ |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=pod |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=encoding UTF-8 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Test::Class::Moose::CLI - Use this in your tcm.t script for a drop-in runner tool |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 VERSION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
version 0.99 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# In a t/tcm.t file ... |
39
|
|
|
|
|
|
|
use Test::Class::Moose::CLI; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Test::Class::Moose::CLI->new_with_options->run; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# From the command line ... |
44
|
|
|
|
|
|
|
$> prove -lv t/tcm.t :: --classes TestFor::Foo --classes TestFor::Bar --tags quick --tags db --jobs 8 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This class provides support for passing various L<Test::Class::Moose::Config> |
49
|
|
|
|
|
|
|
options via the command line. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
It is entirely implemented by the L<Test::Class::Moose::Role::CLI> role, which |
52
|
|
|
|
|
|
|
you can use in your own class to provide your own custom test runner. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 COMMAND LINE OPTIONS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This class allows you to pass the following command-line options: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 --classes |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This should be the full name of one a class that you want to run (rather than |
61
|
|
|
|
|
|
|
running classes). |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
You can also pass a path to a single class. Any leading C<t/lib/> part of the |
64
|
|
|
|
|
|
|
path will be stripped, and the rest will be transformed from a path to a module |
65
|
|
|
|
|
|
|
name. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Finally, you can pass a path to a directory. It will be searched for F<.pm> |
68
|
|
|
|
|
|
|
files and each of those files will be loaded as a test class. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
You can pass this option more than once. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 --methods |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
The name of a method that you want to run. You can pass this option more than |
75
|
|
|
|
|
|
|
once. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This will actually be turned into a regex like C<qr/^(?:foo|bar)$/>. It will be |
78
|
|
|
|
|
|
|
matched against all classes that are being run. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 --exclude-methods |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The name of a method that you do not want to run. You can pass this option more |
83
|
|
|
|
|
|
|
than once. This is turned into a regex just like C<--methods>. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 --tags |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
The name of one or more test method tags that you want to include. Only test |
88
|
|
|
|
|
|
|
method matching these tags will be run. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 --exclude-tags |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The name of one or more test method tags that you want to exclude. Any test |
93
|
|
|
|
|
|
|
methods matching these tags will be ignored. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 --parallel-progress and --no-parallel-progress |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Show a progress indicator when running tests in parallel. Defaults to true. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 --color and --no-color |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Enable/disable color for the parallel progress output. Defaults to true. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 --jobs |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
The number of jobs to run. Defaults to 1. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 --randomize-methods |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
If true, methods for each class will be run in a random order. Defaults to |
110
|
|
|
|
|
|
|
false. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 --randomize-classes |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
If true, classes will be run in a random order. Defaults to false. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 --set-process-name |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
If true, the process name (C<$0>) will be updated to include the name of each |
119
|
|
|
|
|
|
|
test class as the class is being run. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 --statistics |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
If true, this will output some extra statistics info as diagnostic output at |
124
|
|
|
|
|
|
|
the end of the run. Defaults to false unless C<--use-environment> is true and |
125
|
|
|
|
|
|
|
the C<HARNESS_IS_VERBOSE> environment variable is also true. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 --show-timing |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
If true, this will output some extra timing info as diagnostic output at the |
130
|
|
|
|
|
|
|
end of the run. Defaults to false unless C<--use-environment> is true and the |
131
|
|
|
|
|
|
|
C<HARNESS_IS_VERBOSE> environment variable is also true. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 --runner-class |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
The name of the runner class to use. Defaults to L<Test::Class::Moose::Runner>. |
136
|
|
|
|
|
|
|
This class will be loaded when creating the runner if it is not already loaded. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 --test-lib-dirs |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This should be the path to a directory containing test classes. The path can be |
141
|
|
|
|
|
|
|
relative to the project root (F<t/lib>) or absolute. If you do not pass this |
142
|
|
|
|
|
|
|
argument it will default to F<t/lib>. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
You can pass this option more than once if you'd like to include multiple test |
145
|
|
|
|
|
|
|
directories. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 --timing-data-file |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
If this is passed, the value returned by C<< |
150
|
|
|
|
|
|
|
Test::Class::Moose::Report->timing_data >> plus some other information will be |
151
|
|
|
|
|
|
|
encoded as JSON and stored in this file. The exact data stored looks like: |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
{ |
154
|
|
|
|
|
|
|
process_name => $0, |
155
|
|
|
|
|
|
|
start_time => $epoch_time |
156
|
|
|
|
|
|
|
timing => \%timing_data_from_report, |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 LOADING TEST CLASSES |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
If you pass classes with the C<--classes> option, only these classes will be |
162
|
|
|
|
|
|
|
loaded. Otherwise all classes under F<t/lib> will be loaded. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 SUPPORT |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/test-class-moose/issues>. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 SOURCE |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
The source code repository for Test-Class-Moose can be found at L<https://github.com/houseabsolute/test-class-moose>. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHORS |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=over 4 |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item * |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Curtis "Ovid" Poe <ovid@cpan.org> |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item * |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=back |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
This software is copyright (c) 2012 - 2021 by Curtis "Ovid" Poe. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
193
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
The full text of the license can be found in the |
196
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |