📄 test::harness::tap.3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...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...\" Set up some character translations and predefined strings. \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote. \*(C+ will.\" give a nicer C++. Capital omega is used to do unbreakable dashes and.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\. ds -- \(*W-. ds PI pi. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch. ds L" "". ds R" "". ds C` "". ds C' ""'br\}.el\{\. ds -- \|\(em\|. ds PI \(*p. ds L" ``. ds R" '''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 turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD. Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff.if n \{\. ds #H 0. ds #V .8m. ds #F .3m. ds #[ \f1. ds #] \fP.\}.if t \{\. ds #H ((1u-(\\\\n(.fu%2u))*.13m). ds #V .6m. ds #F 0. ds #[ \&. ds #] \&.\}. \" simple accents for nroff and troff.if n \{\. ds ' \&. ds ` \&. ds ^ \&. ds , \&. ds ~ ~. ds /.\}.if t \{\. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u". ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}. \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E. \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'. \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\. ds : e. ds 8 ss. ds o a. ds d- d\h'-1'\(ga. ds D- D\h'-1'\(hy. ds th \o'bp'. ds Th \o'LP'. ds ae ae. ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "Test::Harness::TAP 3".TH Test::Harness::TAP 3 "2007-12-18" "perl v5.10.0" "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"Test::Harness::TAP \- Documentation for the TAP format.SH "SYNOPSIS".IX Header "SYNOPSIS"\&\s-1TAP\s0, the Test Anything Protocol, is Perl's simple text-based interfacebetween testing modules such as Test::More and the test harnessTest::Harness..SH "TODO".IX Header "TODO"Exit code of the process..SH "THE TAP FORMAT".IX Header "THE TAP FORMAT"\&\s-1TAP\s0's general format is:.PP.Vb 7\& 1..N\& ok 1 Description # Directive\& # Diagnostic\& ....\& ok 47 Description\& ok 48 Description\& more tests.....Ve.PPFor example, a test file's output might look like:.PP.Vb 5\& 1..4\& ok 1 \- Input file opened\& not ok 2 \- First line of the input valid\& ok 3 \- Read the rest of the file\& not ok 4 \- Summarized correctly # TODO Not written yet.Ve.SH "HARNESS BEHAVIOR".IX Header "HARNESS BEHAVIOR"In this document, the \*(L"harness\*(R" is any program analyzing \s-1TAP\s0 output.Typically this will be Perl's \fIprove\fR program, or the underlying\&\f(CW\*(C`Test::Harness::runtests\*(C'\fR subroutine..PPA harness must only read \s-1TAP\s0 output from standard output and notfrom standard error. Lines written to standard output matching\&\f(CW\*(C`/^(not )?ok\eb/\*(C'\fR must be interpreted as test lines. All otherlines must not be considered test output..SH "TESTS LINES AND THE PLAN".IX Header "TESTS LINES AND THE PLAN".Sh "The plan".IX Subsection "The plan"The plan tells how many tests will be run, or how many tests haverun. It's a check that the test file hasn't stopped prematurely.It must appear once, whether at the beginning or end of the output..PPThe plan is usually the first line of \s-1TAP\s0 output and it specifies howmany test points are to follow. For example,.PP.Vb 1\& 1..10.Ve.PPmeans you plan on running 10 tests. This is a safeguard in case your testfile dies silently in the middle of its run. The plan is optional but ifthere is a plan before the test points it must be the first non-diagnosticline output by the test file..PPIn certain instances a test file may not know how many test pointsit will ultimately be running. In this case the plan can be the lastnon-diagnostic line in the output..PPThe plan cannot appear in the middle of the output, nor can it appear morethan once..Sh "The test line".IX Subsection "The test line"The core of \s-1TAP\s0 is the test line. A test file prints one test line testpoint executed. There must be at least one test line in \s-1TAP\s0 output. Eachtest line comprises the following elements:.IP "\(bu" 4\&\f(CW\*(C`ok\*(C'\fR or \f(CW\*(C`not ok\*(C'\fR.SpThis tells whether the test point passed or failed. It must beat the beginning of the line. \f(CW\*(C`/^not ok/\*(C'\fR indicates a failed testpoint. \f(CW\*(C`/^ok/\*(C'\fR is a successful test point. This is the only mandatorypart of the line..SpNote that unlike the Directives below, \f(CW\*(C`ok\*(C'\fR and \f(CW\*(C`not ok\*(C'\fR arecase-sensitive..IP "\(bu" 4Test number.Sp\&\s-1TAP\s0 expects the \f(CW\*(C`ok\*(C'\fR or \f(CW\*(C`not ok\*(C'\fR to be followed by a test pointnumber. If there is no number the harness must maintainits own counter until the script supplies test numbers again. Sothe following test output.Sp.Vb 6\& 1..6\& not ok\& ok\& not ok\& ok\& ok.Ve.Sphas five tests. The sixth is missing. Test::Harness will generate.Sp.Vb 2\& FAILED tests 1, 3, 6\& Failed 3/6 tests, 50.00% okay.Ve.IP "\(bu" 4Description.SpAny text after the test number but before a \f(CW\*(C`#\*(C'\fR is the description ofthe test point..Sp.Vb 1\& ok 42 this is the description of the test.Ve.SpDescriptions should not begin with a digit so that they are not confusedwith the test point number..SpThe harness may do whatever it wants with the description..IP "\(bu" 4Directive.SpThe test point may include a directive, following a hash on thetest line. There are currently two directives allowed: \f(CW\*(C`TODO\*(C'\fR and\&\f(CW\*(C`SKIP\*(C'\fR. These are discussed below..PPTo summarize:.IP "\(bu" 4ok/not ok (required).IP "\(bu" 4Test number (recommended).IP "\(bu" 4Description (recommended).IP "\(bu" 4Directive (only when necessary).SH "DIRECTIVES".IX Header "DIRECTIVES"Directives are special notes that follow a \f(CW\*(C`#\*(C'\fR on the test line.Only two are currently defined: \f(CW\*(C`TODO\*(C'\fR and \f(CW\*(C`SKIP\*(C'\fR. Note thatthese two keywords are not case-sensitive..Sh "\s-1TODO\s0 tests".IX Subsection "TODO tests"If the directive starts with \f(CW\*(C`# TODO\*(C'\fR, the test is counted as atodo test, and the text after \f(CW\*(C`TODO\*(C'\fR is the explanation..PP.Vb 1\& not ok 13 # TODO bend space and time.Ve.PPNote that if the \s-1TODO\s0 has an explanation it must be separated from\&\f(CW\*(C`TODO\*(C'\fR by a space..PPThese tests represent a feature to be implemented or a bug to be fixedand act as something of an executable \*(L"things to do\*(R" list. They are\&\fBnot\fR expected to succeed. Should a todo test point begin succeeding,the harness should report it as a bonus. This indicates that whateveryou were supposed to do has been done and you should promote this to anormal test point..Sh "Skipping tests".IX Subsection "Skipping tests"If the directive starts with \f(CW\*(C`# SKIP\*(C'\fR, the test is counted as havingbeen skipped. If the whole test file succeeds, the count of skippedtests is included in the generated output. The harness should reportthe text after \f(CW\*(C` # SKIP\eS*\es+\*(C'\fR as a reason for skipping..PP.Vb 1\& ok 23 # skip Insufficient flogiston pressure..Ve.PPSimilarly, one can include an explanation in a plan line,emitted if the test file is skipped completely:.PP.Vb 1\& 1..0 # Skipped: WWW::Mechanize not installed.Ve.SH "OTHER LINES".IX Header "OTHER LINES".Sh "Bail out!"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -