summaryrefslogtreecommitdiffstats
path: root/upstream/mageia-cauldron/man3pm/App::Prove.3pm
blob: c67b22fecff24072f85296e9cb6d523cf934a63f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "App::Prove 3pm"
.TH App::Prove 3pm 2023-11-28 "perl v5.38.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
App::Prove \- Implements the "prove" command.
.SH VERSION
.IX Header "VERSION"
Version 3.44
.SH DESCRIPTION
.IX Header "DESCRIPTION"
Test::Harness provides a command, \f(CW\*(C`prove\*(C'\fR, which runs a TAP based
test suite and prints a report. The \f(CW\*(C`prove\*(C'\fR command is a minimal
wrapper around an instance of this module.
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 1
\&    use App::Prove;
\&
\&    my $app = App::Prove\->new;
\&    $app\->process_args(@ARGV);
\&    $app\->run;
.Ve
.SH METHODS
.IX Header "METHODS"
.SS "Class Methods"
.IX Subsection "Class Methods"
\fR\f(CI\*(C`new\*(C'\fR\fI\fR
.IX Subsection "new"
.PP
Create a new \f(CW\*(C`App::Prove\*(C'\fR. Optionally a hash ref of attribute
initializers may be passed.
.PP
\fR\f(CI\*(C`state_class\*(C'\fR\fI\fR
.IX Subsection "state_class"
.PP
Getter/setter for the name of the class used for maintaining state.  This
class should either subclass from \f(CW\*(C`App::Prove::State\*(C'\fR or provide an identical
interface.
.PP
\fR\f(CI\*(C`state_manager\*(C'\fR\fI\fR
.IX Subsection "state_manager"
.PP
Getter/setter for the instance of the \f(CW\*(C`state_class\*(C'\fR.
.PP
\fR\f(CI\*(C`add_rc_file\*(C'\fR\fI\fR
.IX Subsection "add_rc_file"
.PP
.Vb 1
\&    $prove\->add_rc_file(\*(Aqmyproj/.proverc\*(Aq);
.Ve
.PP
Called before \f(CW\*(C`process_args\*(C'\fR to prepend the contents of an rc file to
the options.
.PP
\fR\f(CI\*(C`process_args\*(C'\fR\fI\fR
.IX Subsection "process_args"
.PP
.Vb 1
\&    $prove\->process_args(@args);
.Ve
.PP
Processes the command-line arguments. Attributes will be set
appropriately. Any filenames may be found in the \f(CW\*(C`argv\*(C'\fR attribute.
.PP
Dies on invalid arguments.
.PP
\fR\f(CI\*(C`run\*(C'\fR\fI\fR
.IX Subsection "run"
.PP
Perform whatever actions the command line args specified. The \f(CW\*(C`prove\*(C'\fR
command line tool consists of the following code:
.PP
.Vb 1
\&    use App::Prove;
\&
\&    my $app = App::Prove\->new;
\&    $app\->process_args(@ARGV);
\&    exit( $app\->run ? 0 : 1 );  # if you need the exit code
.Ve
.PP
\fR\f(CI\*(C`require_harness\*(C'\fR\fI\fR
.IX Subsection "require_harness"
.PP
Load a harness replacement class.
.PP
.Vb 1
\&  $prove\->require_harness($for => $class_name);
.Ve
.PP
\fR\f(CI\*(C`print_version\*(C'\fR\fI\fR
.IX Subsection "print_version"
.PP
Display the version numbers of the loaded TAP::Harness and the
current Perl.
.SS Attributes
.IX Subsection "Attributes"
After command line parsing the following attributes reflect the values
of the corresponding command line switches. They may be altered before
calling \f(CW\*(C`run\*(C'\fR.
.ie n .IP """archive""" 4
.el .IP \f(CWarchive\fR 4
.IX Item "archive"
.PD 0
.ie n .IP """argv""" 4
.el .IP \f(CWargv\fR 4
.IX Item "argv"
.ie n .IP """backwards""" 4
.el .IP \f(CWbackwards\fR 4
.IX Item "backwards"
.ie n .IP """blib""" 4
.el .IP \f(CWblib\fR 4
.IX Item "blib"
.ie n .IP """color""" 4
.el .IP \f(CWcolor\fR 4
.IX Item "color"
.ie n .IP """directives""" 4
.el .IP \f(CWdirectives\fR 4
.IX Item "directives"
.ie n .IP """dry""" 4
.el .IP \f(CWdry\fR 4
.IX Item "dry"
.ie n .IP """exec""" 4
.el .IP \f(CWexec\fR 4
.IX Item "exec"
.ie n .IP """extensions""" 4
.el .IP \f(CWextensions\fR 4
.IX Item "extensions"
.ie n .IP """failures""" 4
.el .IP \f(CWfailures\fR 4
.IX Item "failures"
.ie n .IP """comments""" 4
.el .IP \f(CWcomments\fR 4
.IX Item "comments"
.ie n .IP """formatter""" 4
.el .IP \f(CWformatter\fR 4
.IX Item "formatter"
.ie n .IP """harness""" 4
.el .IP \f(CWharness\fR 4
.IX Item "harness"
.ie n .IP """ignore_exit""" 4
.el .IP \f(CWignore_exit\fR 4
.IX Item "ignore_exit"
.ie n .IP """includes""" 4
.el .IP \f(CWincludes\fR 4
.IX Item "includes"
.ie n .IP """jobs""" 4
.el .IP \f(CWjobs\fR 4
.IX Item "jobs"
.ie n .IP """lib""" 4
.el .IP \f(CWlib\fR 4
.IX Item "lib"
.ie n .IP """merge""" 4
.el .IP \f(CWmerge\fR 4
.IX Item "merge"
.ie n .IP """modules""" 4
.el .IP \f(CWmodules\fR 4
.IX Item "modules"
.ie n .IP """parse""" 4
.el .IP \f(CWparse\fR 4
.IX Item "parse"
.ie n .IP """plugins""" 4
.el .IP \f(CWplugins\fR 4
.IX Item "plugins"
.ie n .IP """quiet""" 4
.el .IP \f(CWquiet\fR 4
.IX Item "quiet"
.ie n .IP """really_quiet""" 4
.el .IP \f(CWreally_quiet\fR 4
.IX Item "really_quiet"
.ie n .IP """recurse""" 4
.el .IP \f(CWrecurse\fR 4
.IX Item "recurse"
.ie n .IP """rules""" 4
.el .IP \f(CWrules\fR 4
.IX Item "rules"
.ie n .IP """show_count""" 4
.el .IP \f(CWshow_count\fR 4
.IX Item "show_count"
.ie n .IP """show_help""" 4
.el .IP \f(CWshow_help\fR 4
.IX Item "show_help"
.ie n .IP """show_man""" 4
.el .IP \f(CWshow_man\fR 4
.IX Item "show_man"
.ie n .IP """show_version""" 4
.el .IP \f(CWshow_version\fR 4
.IX Item "show_version"
.ie n .IP """shuffle""" 4
.el .IP \f(CWshuffle\fR 4
.IX Item "shuffle"
.ie n .IP """state""" 4
.el .IP \f(CWstate\fR 4
.IX Item "state"
.ie n .IP """state_class""" 4
.el .IP \f(CWstate_class\fR 4
.IX Item "state_class"
.ie n .IP """taint_fail""" 4
.el .IP \f(CWtaint_fail\fR 4
.IX Item "taint_fail"
.ie n .IP """taint_warn""" 4
.el .IP \f(CWtaint_warn\fR 4
.IX Item "taint_warn"
.ie n .IP """test_args""" 4
.el .IP \f(CWtest_args\fR 4
.IX Item "test_args"
.ie n .IP """timer""" 4
.el .IP \f(CWtimer\fR 4
.IX Item "timer"
.ie n .IP """verbose""" 4
.el .IP \f(CWverbose\fR 4
.IX Item "verbose"
.ie n .IP """warnings_fail""" 4
.el .IP \f(CWwarnings_fail\fR 4
.IX Item "warnings_fail"
.ie n .IP """warnings_warn""" 4
.el .IP \f(CWwarnings_warn\fR 4
.IX Item "warnings_warn"
.ie n .IP """tapversion""" 4
.el .IP \f(CWtapversion\fR 4
.IX Item "tapversion"
.ie n .IP """trap""" 4
.el .IP \f(CWtrap\fR 4
.IX Item "trap"
.PD
.SH PLUGINS
.IX Header "PLUGINS"
\&\f(CW\*(C`App::Prove\*(C'\fR provides support for 3rd\-party plugins.  These are currently
loaded at run-time, \fIafter\fR arguments have been parsed (so you can not
change the way arguments are processed, sorry), typically with the
\&\f(CW\*(C`\-P\fR\f(CIplugin\fR\f(CW\*(C'\fR switch, eg:
.PP
.Vb 1
\&  prove \-PMyPlugin
.Ve
.PP
This will search for a module named \f(CW\*(C`App::Prove::Plugin::MyPlugin\*(C'\fR, or failing
that, \f(CW\*(C`MyPlugin\*(C'\fR.  If the plugin can't be found, \f(CW\*(C`prove\*(C'\fR will complain & exit.
.PP
You can pass an argument to your plugin by appending an \f(CW\*(C`=\*(C'\fR after the plugin
name, eg \f(CW\*(C`\-PMyPlugin=foo\*(C'\fR.  You can pass multiple arguments using commas:
.PP
.Vb 1
\&  prove \-PMyPlugin=foo,bar,baz
.Ve
.PP
These are passed in to your plugin's \f(CWload()\fR class method (if it has one),
along with a reference to the \f(CW\*(C`App::Prove\*(C'\fR object that is invoking your plugin:
.PP
.Vb 2
\&  sub load {
\&      my ($class, $p) = @_;
\&
\&      my @args = @{ $p\->{args} };
\&      # @args will contain ( \*(Aqfoo\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz\*(Aq )
\&      $p\->{app_prove}\->do_something;
\&      ...
\&  }
.Ve
.PP
Note that the user's arguments are also passed to your plugin's \f(CWimport()\fR
function as a list, eg:
.PP
.Vb 5
\&  sub import {
\&      my ($class, @args) = @_;
\&      # @args will contain ( \*(Aqfoo\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz\*(Aq )
\&      ...
\&  }
.Ve
.PP
This is for backwards compatibility, and may be deprecated in the future.
.SS "Sample Plugin"
.IX Subsection "Sample Plugin"
Here's a sample plugin, for your reference:
.PP
.Vb 1
\&  package App::Prove::Plugin::Foo;
\&
\&  # Sample plugin, try running with:
\&  # prove \-PFoo=bar \-r \-j3
\&  # prove \-PFoo \-Q
\&  # prove \-PFoo=bar,My::Formatter
\&
\&  use strict;
\&  use warnings;
\&
\&  sub load {
\&      my ($class, $p) = @_;
\&      my @args = @{ $p\->{args} };
\&      my $app  = $p\->{app_prove};
\&
\&      print "loading plugin: $class, args: ", join(\*(Aq, \*(Aq, @args ), "\en";
\&
\&      # turn on verbosity
\&      $app\->verbose( 1 );
\&
\&      # set the formatter?
\&      $app\->formatter( $args[1] ) if @args > 1;
\&
\&      # print some of App::Prove\*(Aqs state:
\&      for my $attr (qw( jobs quiet really_quiet recurse verbose )) {
\&          my $val = $app\->$attr;
\&          $val    = \*(Aqundef\*(Aq unless defined( $val );
\&          print "$attr: $val\en";
\&      }
\&
\&      return 1;
\&  }
\&
\&  1;
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
prove, TAP::Harness