Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "Test::Builder 3" | |
132 | .TH Test::Builder 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | Test::Builder \- Backend for building test libraries | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 5 | |
138 | \& package My::Test::Module; | |
139 | \& use Test::Builder; | |
140 | \& require Exporter; | |
141 | \& @ISA = qw(Exporter); | |
142 | \& @EXPORT = qw(ok); | |
143 | .Ve | |
144 | .PP | |
145 | .Vb 2 | |
146 | \& my $Test = Test::Builder->new; | |
147 | \& $Test->output('my_logfile'); | |
148 | .Ve | |
149 | .PP | |
150 | .Vb 3 | |
151 | \& sub import { | |
152 | \& my($self) = shift; | |
153 | \& my $pack = caller; | |
154 | .Ve | |
155 | .PP | |
156 | .Vb 2 | |
157 | \& $Test->exported_to($pack); | |
158 | \& $Test->plan(@_); | |
159 | .Ve | |
160 | .PP | |
161 | .Vb 2 | |
162 | \& $self->export_to_level(1, $self, 'ok'); | |
163 | \& } | |
164 | .Ve | |
165 | .PP | |
166 | .Vb 2 | |
167 | \& sub ok { | |
168 | \& my($test, $name) = @_; | |
169 | .Ve | |
170 | .PP | |
171 | .Vb 2 | |
172 | \& $Test->ok($test, $name); | |
173 | \& } | |
174 | .Ve | |
175 | .SH "DESCRIPTION" | |
176 | .IX Header "DESCRIPTION" | |
177 | Test::Simple and Test::More have proven to be popular testing modules, | |
178 | but they're not always flexible enough. Test::Builder provides the a | |
179 | building block upon which to write your own test libraries \fIwhich can | |
180 | work together\fR. | |
181 | .Sh "Construction" | |
182 | .IX Subsection "Construction" | |
183 | .IP "\fBnew\fR" 4 | |
184 | .IX Item "new" | |
185 | .Vb 1 | |
186 | \& my $Test = Test::Builder->new; | |
187 | .Ve | |
188 | .Sp | |
189 | Returns a Test::Builder object representing the current state of the | |
190 | test. | |
191 | .Sp | |
192 | Since you only run one test per program, there is \fBone and only one\fR | |
193 | Test::Builder object. No matter how many times you call \fInew()\fR, you're | |
194 | getting the same object. (This is called a singleton). | |
195 | .Sh "Setting up tests" | |
196 | .IX Subsection "Setting up tests" | |
197 | These methods are for setting up tests and declaring how many there | |
198 | are. You usually only want to call one of these methods. | |
199 | .IP "\fBexported_to\fR" 4 | |
200 | .IX Item "exported_to" | |
201 | .Vb 2 | |
202 | \& my $pack = $Test->exported_to; | |
203 | \& $Test->exported_to($pack); | |
204 | .Ve | |
205 | .Sp | |
206 | Tells Test::Builder what package you exported your functions to. | |
207 | This is important for getting \s-1TODO\s0 tests right. | |
208 | .IP "\fBplan\fR" 4 | |
209 | .IX Item "plan" | |
210 | .Vb 3 | |
211 | \& $Test->plan('no_plan'); | |
212 | \& $Test->plan( skip_all => $reason ); | |
213 | \& $Test->plan( tests => $num_tests ); | |
214 | .Ve | |
215 | .Sp | |
216 | A convenient way to set up your tests. Call this and Test::Builder | |
217 | will print the appropriate headers and take the appropriate actions. | |
218 | .Sp | |
219 | If you call \fIplan()\fR, don't call any of the other methods below. | |
220 | .IP "\fBexpected_tests\fR" 4 | |
221 | .IX Item "expected_tests" | |
222 | .Vb 2 | |
223 | \& my $max = $Test->expected_tests; | |
224 | \& $Test->expected_tests($max); | |
225 | .Ve | |
226 | .Sp | |
227 | Gets/sets the # of tests we expect this test to run and prints out | |
228 | the appropriate headers. | |
229 | .IP "\fBno_plan\fR" 4 | |
230 | .IX Item "no_plan" | |
231 | .Vb 1 | |
232 | \& $Test->no_plan; | |
233 | .Ve | |
234 | .Sp | |
235 | Declares that this test will run an indeterminate # of tests. | |
236 | .IP "\fBskip_all\fR" 4 | |
237 | .IX Item "skip_all" | |
238 | .Vb 2 | |
239 | \& $Test->skip_all; | |
240 | \& $Test->skip_all($reason); | |
241 | .Ve | |
242 | .Sp | |
243 | Skips all the tests, using the given \f(CW$reason\fR. Exits immediately with 0. | |
244 | .Sh "Running tests" | |
245 | .IX Subsection "Running tests" | |
246 | These actually run the tests, analogous to the functions in | |
247 | Test::More. | |
248 | .PP | |
249 | $name is always optional. | |
250 | .IP "\fBok\fR" 4 | |
251 | .IX Item "ok" | |
252 | .Vb 1 | |
253 | \& $Test->ok($test, $name); | |
254 | .Ve | |
255 | .Sp | |
256 | Your basic test. Pass if \f(CW$test\fR is true, fail if \f(CW$test\fR is false. Just | |
257 | like Test::Simple's \fIok()\fR. | |
258 | .IP "\fBis_eq\fR" 4 | |
259 | .IX Item "is_eq" | |
260 | .Vb 1 | |
261 | \& $Test->is_eq($got, $expected, $name); | |
262 | .Ve | |
263 | .Sp | |
264 | Like Test::More's \fIis()\fR. Checks if \f(CW$got\fR eq \f(CW$expected\fR. This is the | |
265 | string version. | |
266 | .IP "\fBis_num\fR" 4 | |
267 | .IX Item "is_num" | |
268 | .Vb 1 | |
269 | \& $Test->is_num($got, $expected, $name); | |
270 | .Ve | |
271 | .Sp | |
272 | Like Test::More's \fIis()\fR. Checks if \f(CW$got\fR == \f(CW$expected\fR. This is the | |
273 | numeric version. | |
274 | .IP "\fBisnt_eq\fR" 4 | |
275 | .IX Item "isnt_eq" | |
276 | .Vb 1 | |
277 | \& $Test->isnt_eq($got, $dont_expect, $name); | |
278 | .Ve | |
279 | .Sp | |
280 | Like Test::More's \fIisnt()\fR. Checks if \f(CW$got\fR ne \f(CW$dont_expect\fR. This is | |
281 | the string version. | |
282 | .IP "\fBisnt_num\fR" 4 | |
283 | .IX Item "isnt_num" | |
284 | .Vb 1 | |
285 | \& $Test->is_num($got, $dont_expect, $name); | |
286 | .Ve | |
287 | .Sp | |
288 | Like Test::More's \fIisnt()\fR. Checks if \f(CW$got\fR ne \f(CW$dont_expect\fR. This is | |
289 | the numeric version. | |
290 | .IP "\fBlike\fR" 4 | |
291 | .IX Item "like" | |
292 | .Vb 2 | |
293 | \& $Test->like($this, qr/$regex/, $name); | |
294 | \& $Test->like($this, '/$regex/', $name); | |
295 | .Ve | |
296 | .Sp | |
297 | Like Test::More's \fIlike()\fR. Checks if \f(CW$this\fR matches the given \f(CW$regex\fR. | |
298 | .Sp | |
299 | You'll want to avoid qr// if you want your tests to work before 5.005. | |
300 | .IP "\fBunlike\fR" 4 | |
301 | .IX Item "unlike" | |
302 | .Vb 2 | |
303 | \& $Test->unlike($this, qr/$regex/, $name); | |
304 | \& $Test->unlike($this, '/$regex/', $name); | |
305 | .Ve | |
306 | .Sp | |
307 | Like Test::More's \fIunlike()\fR. Checks if \f(CW$this\fR \fBdoes not match\fR the | |
308 | given \f(CW$regex\fR. | |
309 | .IP "\fBmaybe_regex\fR" 4 | |
310 | .IX Item "maybe_regex" | |
311 | .Vb 2 | |
312 | \& $Test->maybe_regex(qr/$regex/); | |
313 | \& $Test->maybe_regex('/$regex/'); | |
314 | .Ve | |
315 | .Sp | |
316 | Convenience method for building testing functions that take regular | |
317 | expressions as arguments, but need to work before perl 5.005. | |
318 | .Sp | |
319 | Takes a quoted regular expression produced by qr//, or a string | |
320 | representing a regular expression. | |
321 | .Sp | |
322 | Returns a Perl value which may be used instead of the corresponding | |
323 | regular expression, or undef if it's argument is not recognised. | |
324 | .Sp | |
325 | For example, a version of \fIlike()\fR, sans the useful diagnostic messages, | |
326 | could be written as: | |
327 | .Sp | |
328 | .Vb 7 | |
329 | \& sub laconic_like { | |
330 | \& my ($self, $this, $regex, $name) = @_; | |
331 | \& my $usable_regex = $self->maybe_regex($regex); | |
332 | \& die "expecting regex, found '$regex'\en" | |
333 | \& unless $usable_regex; | |
334 | \& $self->ok($this =~ m/$usable_regex/, $name); | |
335 | \& } | |
336 | .Ve | |
337 | .IP "\fBcmp_ok\fR" 4 | |
338 | .IX Item "cmp_ok" | |
339 | .Vb 1 | |
340 | \& $Test->cmp_ok($this, $type, $that, $name); | |
341 | .Ve | |
342 | .Sp | |
343 | Works just like Test::More's \fIcmp_ok()\fR. | |
344 | .Sp | |
345 | .Vb 1 | |
346 | \& $Test->cmp_ok($big_num, '!=', $other_big_num); | |
347 | .Ve | |
348 | .IP "\fB\s-1BAILOUT\s0\fR" 4 | |
349 | .IX Item "BAILOUT" | |
350 | .Vb 1 | |
351 | \& $Test->BAILOUT($reason); | |
352 | .Ve | |
353 | .Sp | |
354 | Indicates to the Test::Harness that things are going so badly all | |
355 | testing should terminate. This includes running any additional test | |
356 | scripts. | |
357 | .Sp | |
358 | It will exit with 255. | |
359 | .IP "\fBskip\fR" 4 | |
360 | .IX Item "skip" | |
361 | .Vb 2 | |
362 | \& $Test->skip; | |
363 | \& $Test->skip($why); | |
364 | .Ve | |
365 | .Sp | |
366 | Skips the current test, reporting \f(CW$why\fR. | |
367 | .IP "\fBtodo_skip\fR" 4 | |
368 | .IX Item "todo_skip" | |
369 | .Vb 2 | |
370 | \& $Test->todo_skip; | |
371 | \& $Test->todo_skip($why); | |
372 | .Ve | |
373 | .Sp | |
374 | Like \fIskip()\fR, only it will declare the test as failing and \s-1TODO\s0. Similar | |
375 | to | |
376 | .Sp | |
377 | .Vb 1 | |
378 | \& print "not ok $tnum # TODO $why\en"; | |
379 | .Ve | |
380 | .Sh "Test style" | |
381 | .IX Subsection "Test style" | |
382 | .IP "\fBlevel\fR" 4 | |
383 | .IX Item "level" | |
384 | .Vb 1 | |
385 | \& $Test->level($how_high); | |
386 | .Ve | |
387 | .Sp | |
388 | How far up the call stack should \f(CW$Test\fR look when reporting where the | |
389 | test failed. | |
390 | .Sp | |
391 | Defaults to 1. | |
392 | .Sp | |
393 | Setting \f(CW$Test::Builder::Level\fR overrides. This is typically useful | |
394 | localized: | |
395 | .Sp | |
396 | .Vb 4 | |
397 | \& { | |
398 | \& local $Test::Builder::Level = 2; | |
399 | \& $Test->ok($test); | |
400 | \& } | |
401 | .Ve | |
402 | .IP "\fBuse_numbers\fR" 4 | |
403 | .IX Item "use_numbers" | |
404 | .Vb 1 | |
405 | \& $Test->use_numbers($on_or_off); | |
406 | .Ve | |
407 | .Sp | |
408 | Whether or not the test should output numbers. That is, this if true: | |
409 | .Sp | |
410 | .Vb 3 | |
411 | \& ok 1 | |
412 | \& ok 2 | |
413 | \& ok 3 | |
414 | .Ve | |
415 | .Sp | |
416 | or this if false | |
417 | .Sp | |
418 | .Vb 3 | |
419 | \& ok | |
420 | \& ok | |
421 | \& ok | |
422 | .Ve | |
423 | .Sp | |
424 | Most useful when you can't depend on the test output order, such as | |
425 | when threads or forking is involved. | |
426 | .Sp | |
427 | Test::Harness will accept either, but avoid mixing the two styles. | |
428 | .Sp | |
429 | Defaults to on. | |
430 | .IP "\fBno_header\fR" 4 | |
431 | .IX Item "no_header" | |
432 | .Vb 1 | |
433 | \& $Test->no_header($no_header); | |
434 | .Ve | |
435 | .Sp | |
436 | If set to true, no \*(L"1..N\*(R" header will be printed. | |
437 | .IP "\fBno_ending\fR" 4 | |
438 | .IX Item "no_ending" | |
439 | .Vb 1 | |
440 | \& $Test->no_ending($no_ending); | |
441 | .Ve | |
442 | .Sp | |
443 | Normally, Test::Builder does some extra diagnostics when the test | |
444 | ends. It also changes the exit code as described in Test::Simple. | |
445 | .Sp | |
446 | If this is true, none of that will be done. | |
447 | .Sh "Output" | |
448 | .IX Subsection "Output" | |
449 | Controlling where the test output goes. | |
450 | .PP | |
451 | It's ok for your test to change where \s-1STDOUT\s0 and \s-1STDERR\s0 point to, | |
452 | Test::Builder's default output settings will not be affected. | |
453 | .IP "\fBdiag\fR" 4 | |
454 | .IX Item "diag" | |
455 | .Vb 1 | |
456 | \& $Test->diag(@msgs); | |
457 | .Ve | |
458 | .Sp | |
459 | Prints out the given \f(CW$message\fR. Normally, it uses the \fIfailure_output()\fR | |
460 | handle, but if this is for a \s-1TODO\s0 test, the \fItodo_output()\fR handle is | |
461 | used. | |
462 | .Sp | |
463 | Output will be indented and marked with a # so as not to interfere | |
464 | with test output. A newline will be put on the end if there isn't one | |
465 | already. | |
466 | .Sp | |
467 | We encourage using this rather than calling print directly. | |
468 | .Sp | |
469 | Returns false. Why? Because \fIdiag()\fR is often used in conjunction with | |
470 | a failing test (\f(CW\*(C`ok() || diag()\*(C'\fR) it \*(L"passes through\*(R" the failure. | |
471 | .Sp | |
472 | .Vb 1 | |
473 | \& return ok(...) || diag(...); | |
474 | .Ve | |
475 | .IP "\fBoutput\fR" 4 | |
476 | .IX Item "output" | |
477 | .Vb 2 | |
478 | \& $Test->output($fh); | |
479 | \& $Test->output($file); | |
480 | .Ve | |
481 | .Sp | |
482 | Where normal \*(L"ok/not ok\*(R" test output should go. | |
483 | .Sp | |
484 | Defaults to \s-1STDOUT\s0. | |
485 | .IP "\fBfailure_output\fR" 4 | |
486 | .IX Item "failure_output" | |
487 | .Vb 2 | |
488 | \& $Test->failure_output($fh); | |
489 | \& $Test->failure_output($file); | |
490 | .Ve | |
491 | .Sp | |
492 | Where diagnostic output on test failures and \fIdiag()\fR should go. | |
493 | .Sp | |
494 | Defaults to \s-1STDERR\s0. | |
495 | .IP "\fBtodo_output\fR" 4 | |
496 | .IX Item "todo_output" | |
497 | .Vb 2 | |
498 | \& $Test->todo_output($fh); | |
499 | \& $Test->todo_output($file); | |
500 | .Ve | |
501 | .Sp | |
502 | Where diagnostics about todo test failures and \fIdiag()\fR should go. | |
503 | .Sp | |
504 | Defaults to \s-1STDOUT\s0. | |
505 | .Sh "Test Status and Info" | |
506 | .IX Subsection "Test Status and Info" | |
507 | .IP "\fBcurrent_test\fR" 4 | |
508 | .IX Item "current_test" | |
509 | .Vb 2 | |
510 | \& my $curr_test = $Test->current_test; | |
511 | \& $Test->current_test($num); | |
512 | .Ve | |
513 | .Sp | |
514 | Gets/sets the current test # we're on. | |
515 | .Sp | |
516 | You usually shouldn't have to set this. | |
517 | .IP "\fBsummary\fR" 4 | |
518 | .IX Item "summary" | |
519 | .Vb 1 | |
520 | \& my @tests = $Test->summary; | |
521 | .Ve | |
522 | .Sp | |
523 | A simple summary of the tests so far. True for pass, false for fail. | |
524 | This is a logical pass/fail, so todos are passes. | |
525 | .Sp | |
526 | Of course, test #1 is \f(CW$tests\fR[0], etc... | |
527 | .IP "\fBdetails\fR \fI\s-1UNIMPLEMENTED\s0\fR" 4 | |
528 | .IX Item "details UNIMPLEMENTED" | |
529 | .Vb 1 | |
530 | \& my @tests = $Test->details; | |
531 | .Ve | |
532 | .Sp | |
533 | Like \fIsummary()\fR, but with a lot more detail. | |
534 | .Sp | |
535 | .Vb 7 | |
536 | \& $tests[$test_num - 1] = | |
537 | \& { ok => is the test considered ok? | |
538 | \& actual_ok => did it literally say 'ok'? | |
539 | \& name => name of the test (if any) | |
540 | \& type => 'skip' or 'todo' (if any) | |
541 | \& reason => reason for the above (if any) | |
542 | \& }; | |
543 | .Ve | |
544 | .IP "\fBtodo\fR" 4 | |
545 | .IX Item "todo" | |
546 | .Vb 2 | |
547 | \& my $todo_reason = $Test->todo; | |
548 | \& my $todo_reason = $Test->todo($pack); | |
549 | .Ve | |
550 | .Sp | |
551 | \&\fItodo()\fR looks for a \f(CW$TODO\fR variable in your tests. If set, all tests | |
552 | will be considered 'todo' (see Test::More and Test::Harness for | |
553 | details). Returns the reason (ie. the value of \f(CW$TODO\fR) if running as | |
554 | todo tests, false otherwise. | |
555 | .Sp | |
556 | \&\fItodo()\fR is pretty part about finding the right package to look for | |
557 | \&\f(CW$TODO\fR in. It uses the \fIexported_to()\fR package to find it. If that's | |
558 | not set, it's pretty good at guessing the right package to look at. | |
559 | .Sp | |
560 | Sometimes there is some confusion about where \fItodo()\fR should be looking | |
561 | for the \f(CW$TODO\fR variable. If you want to be sure, tell it explicitly | |
562 | what \f(CW$pack\fR to use. | |
563 | .IP "\fBcaller\fR" 4 | |
564 | .IX Item "caller" | |
565 | .Vb 3 | |
566 | \& my $package = $Test->caller; | |
567 | \& my($pack, $file, $line) = $Test->caller; | |
568 | \& my($pack, $file, $line) = $Test->caller($height); | |
569 | .Ve | |
570 | .Sp | |
571 | Like the normal \fIcaller()\fR, except it reports according to your \fIlevel()\fR. | |
572 | .SH "THREADS" | |
573 | .IX Header "THREADS" | |
574 | In perl 5.8.0 and later, Test::Builder is thread\-safe. The test | |
575 | number is shared amongst all threads. This means if one thread sets | |
576 | the test number using \fIcurrent_test()\fR they will all be effected. | |
577 | .SH "EXAMPLES" | |
578 | .IX Header "EXAMPLES" | |
579 | \&\s-1CPAN\s0 can provide the best examples. Test::Simple, Test::More, | |
580 | Test::Exception and Test::Differences all use Test::Builder. | |
581 | .SH "SEE ALSO" | |
582 | .IX Header "SEE ALSO" | |
583 | Test::Simple, Test::More, Test::Harness | |
584 | .SH "AUTHORS" | |
585 | .IX Header "AUTHORS" | |
586 | Original code by chromatic, maintained by Michael G Schwern | |
587 | <schwern@pobox.com> | |
588 | .SH "COPYRIGHT" | |
589 | .IX Header "COPYRIGHT" | |
590 | Copyright 2001 by chromatic <chromatic@wgz.org>, | |
591 | Michael G Schwern <schwern@pobox.com>. | |
592 | .PP | |
593 | This program is free software; you can redistribute it and/or | |
594 | modify it under the same terms as Perl itself. | |
595 | .PP | |
596 | See \fIhttp://www.perl.com/perl/misc/Artistic.html\fR |