⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test::builder::tester.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 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::Builder::Tester 3".TH Test::Builder::Tester 3 "2007-11-29" "perl v5.10.0" "User Contributed Perl Documentation".\" 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::Builder::Tester \- test testsuites that have been built withTest::Builder.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 2\&    use Test::Builder::Tester tests => 1;\&    use Test::More;\&\&    test_out("not ok 1 \- foo");\&    test_fail(+1);\&    fail("foo");\&    test_test("fail works");.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"A module that helps you test testing modules that are built with\&\fBTest::Builder\fR..PPThe testing system is designed to be used by performing a three stepprocess for each test you wish to test.  This process starts with using\&\f(CW\*(C`test_out\*(C'\fR and \f(CW\*(C`test_err\*(C'\fR in advance to declare what the testsuite youare testing will output with \fBTest::Builder\fR to stdout and stderr..PPYou then can run the test(s) from your test suite that call\&\fBTest::Builder\fR.  At this point the output of \fBTest::Builder\fR issafely captured by \fBTest::Builder::Tester\fR rather than beinginterpreted as real test output..PPThe final stage is to call \f(CW\*(C`test_test\*(C'\fR that will simply compare what youpredeclared to what \fBTest::Builder\fR actually outputted, and report theresults back with a \*(L"ok\*(R" or \*(L"not ok\*(R" (with debugging) to the normaloutput..Sh "Functions".IX Subsection "Functions"These are the six methods that are exported as default..IP "test_out" 4.IX Item "test_out".PD 0.IP "test_err" 4.IX Item "test_err".PDProcedures for predeclaring the output that your test suite isexpected to produce until \f(CW\*(C`test_test\*(C'\fR is called.  These proceduresautomatically assume that each line terminates with \*(L"\en\*(R".  So.Sp.Vb 1\&   test_out("ok 1","ok 2");.Ve.Spis the same as.Sp.Vb 1\&   test_out("ok 1\enok 2");.Ve.Spwhich is even the same as.Sp.Vb 2\&   test_out("ok 1");\&   test_out("ok 2");.Ve.SpOnce \f(CW\*(C`test_out\*(C'\fR or \f(CW\*(C`test_err\*(C'\fR (or \f(CW\*(C`test_fail\*(C'\fR or \f(CW\*(C`test_diag\*(C'\fR) havebeen called once all further output from \fBTest::Builder\fR will becaptured by \fBTest::Builder::Tester\fR.  This means that your will notbe able perform further tests to the normal output in the normal wayuntil you call \f(CW\*(C`test_test\*(C'\fR (well, unless you manually meddle with theoutput filehandles).IP "test_fail" 4.IX Item "test_fail"Because the standard failure message that \fBTest::Builder\fR produceswhenever a test fails will be a common occurrence in your test erroroutput, and because has changed between Test::Builder versions, ratherthan forcing you to call \f(CW\*(C`test_err\*(C'\fR with the string all the time likeso.Sp.Vb 1\&    test_err("# Failed test ($0 at line ".line_num(+1).")");.Ve.Sp\&\f(CW\*(C`test_fail\*(C'\fR exists as a convenience function that can be calledinstead.  It takes one argument, the offset from the current line thatthe line that causes the fail is on..Sp.Vb 1\&    test_fail(+1);.Ve.SpThis means that the example in the synopsis could be rewrittenmore simply as:.Sp.Vb 4\&   test_out("not ok 1 \- foo");\&   test_fail(+1);\&   fail("foo");\&   test_test("fail works");.Ve.IP "test_diag" 4.IX Item "test_diag"As most of the remaining expected output to the error stream will becreated by Test::Builder's \f(CW\*(C`diag\*(C'\fR function, \fBTest::Builder::Tester\fRprovides a convience function \f(CW\*(C`test_diag\*(C'\fR that you can use instead of\&\f(CW\*(C`test_err\*(C'\fR..SpThe \f(CW\*(C`test_diag\*(C'\fR function prepends comment hashes and spacing to thestart and newlines to the end of the expected output passed to it andadds it to the list of expected error output.  So, instead of writing.Sp.Vb 1\&   test_err("# Couldn\*(Aqt open file");.Ve.Spyou can write.Sp.Vb 1\&   test_diag("Couldn\*(Aqt open file");.Ve.SpRemember that \fBTest::Builder\fR's diag function will not add newlines tothe end of output and test_diag will. So to check.Sp.Vb 1\&   Test::Builder\->new\->diag("foo\en","bar\en");.Ve.SpYou would do.Sp.Vb 1\&  test_diag("foo","bar").Ve.Spwithout the newlines..IP "test_test" 4.IX Item "test_test"Actually performs the output check testing the tests, comparing thedata (with \f(CW\*(C`eq\*(C'\fR) that we have captured from \fBTest::Builder\fR againstthat that was declared with \f(CW\*(C`test_out\*(C'\fR and \f(CW\*(C`test_err\*(C'\fR..SpThis takes name/value pairs that effect how the test is run..RS 4.IP "title (synonym 'name', 'label')" 4.IX Item "title (synonym 'name', 'label')"The name of the test that will be displayed after the \f(CW\*(C`ok\*(C'\fR or \f(CW\*(C`notok\*(C'\fR..IP "skip_out" 4.IX Item "skip_out"Setting this to a true value will cause the test to ignore if theoutput sent by the test to the output stream does not match thatdeclared with \f(CW\*(C`test_out\*(C'\fR..IP "skip_err" 4.IX Item "skip_err"Setting this to a true value will cause the test to ignore if theoutput sent by the test to the error stream does not match thatdeclared with \f(CW\*(C`test_err\*(C'\fR..RE.RS 4.SpAs a convience, if only one argument is passed then this argumentis assumed to be the name of the test (as in the above examples.).SpOnce \f(CW\*(C`test_test\*(C'\fR has been run test output will be redirected back tothe original filehandles that \fBTest::Builder\fR was connected to(probably \s-1STDOUT\s0 and \s-1STDERR\s0,) meaning any further tests you runwill function normally and cause success/errors for \fBTest::Harness\fR..RE.IP "line_num" 4.IX Item "line_num"A utility function that returns the line number that the function wascalled on.  You can pass it an offset which will be added to theresult.  This is very useful for working out the correct text ofdiagnostic functions that contain line numbers..SpEssentially this is the same as the \f(CW\*(C`_\|_LINE_\|_\*(C'\fR macro, but the\&\f(CW\*(C`line_num(+3)\*(C'\fR idiom is arguably nicer..PPIn addition to the six exported functions there there exists onefunction that can only be accessed with a fully qualified functioncall..IP "color" 4.IX Item "color"When \f(CW\*(C`test_test\*(C'\fR is called and the output that your tests generatedoes not match that which you declared, \f(CW\*(C`test_test\*(C'\fR will print outdebug information showing the two conflicting versions.  As thisoutput itself is debug information it can be confusing which part ofthe output is from \f(CW\*(C`test_test\*(C'\fR and which was the original output fromyour original tests.  Also, it may be hard to spot things likeextraneous whitespace at the end of lines that may cause your test tofail even though the output looks similar..SpTo assist you, if you have the \fBTerm::ANSIColor\fR module installed(which you should do by default from perl 5.005 onwards), \f(CW\*(C`test_test\*(C'\fRcan colour the background of the debug information to disambiguate thedifferent types of output. The debug output will have it's backgroundcoloured green and red.  The green part represents the text which isthe same between the executed and actual output, the red shows whichpart differs..SpThe \f(CW\*(C`color\*(C'\fR function determines if colouring should occur or not.Passing it a true or false value will enable or disable colouringrespectively, and the function called with no argument will return thecurrent setting..SpTo enable colouring from the command line, you can use the\&\fBText::Builder::Tester::Color\fR module like so:.Sp.Vb 1\&   perl \-Mlib=Text::Builder::Tester::Color test.t.Ve.SpOr by including the \fBTest::Builder::Tester::Color\fR module directly inthe \s-1PERL5LIB\s0..SH "BUGS".IX Header "BUGS"Calls \f(CW\*(C`<Test::Builder\-\*(C'\fRno_ending>> turning off the ending tests.This is needed as otherwise it will trip out because we've run moretests than we strictly should have and it'll register any failures wehad that we were testing for as real failures..PPThe color function doesn't work unless \fBTerm::ANSIColor\fR is installedand is compatible with your terminal..PPBugs (and requests for new features) can be reported to the authorthough the \s-1CPAN\s0 \s-1RT\s0 system:<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test\-Builder\-Tester>.SH "AUTHOR".IX Header "AUTHOR"Copyright Mark Fowler <mark@twoshortplanks.com> 2002, 2004..PPSome code taken from \fBTest::More\fR and \fBTest::Catch\fR, written by byMichael G Schwern <schwern@pobox.com>.  Hence, those partsCopyright Micheal G Schwern 2001.  Used and distributed withpermission..PPThis program is free software; you can redistribute itand/or modify it under the same terms as Perl itself..SH "NOTES".IX Header "NOTES"This code has been tested explicitly on the following versionsof perl: 5.7.3, 5.6.1, 5.6.0, 5.005_03, 5.004_05 and 5.004..PPThanks to Richard Clamp <richardc@unixbeard.net> for lettingme use his testing system to try this module out on..SH "SEE ALSO".IX Header "SEE ALSO"Test::Builder, Test::Builder::Tester::Color, Test::More.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -