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

📄 tap::parser.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 3 页
字号:
Returns a boolean value indicating whether or not the number of tests plannedmatches the number of tests run..PP\&\fBNote:\fR  this was formerly \f(CW\*(C`good_plan\*(C'\fR.  The latter method is deprecated andwill issue a warning..PPAnd since we're on that subject ....PP\fI\f(CI\*(C`tests_planned\*(C'\fI\fR.IX Subsection "tests_planned".PP.Vb 1\&  print $parser\->tests_planned;.Ve.PPReturns the number of tests planned, according to the plan.  For example, aplan of '1..17' will mean that 17 tests were planned..PP\fI\f(CI\*(C`tests_run\*(C'\fI\fR.IX Subsection "tests_run".PP.Vb 1\&  print $parser\->tests_run;.Ve.PPReturns the number of tests which actually were run.  Hopefully this willmatch the number of \f(CW\*(C`$parser\->tests_planned\*(C'\fR..PP\fI\f(CI\*(C`skip_all\*(C'\fI\fR.IX Subsection "skip_all".PPReturns a true value (actually the reason for skipping) if all testswere skipped..PP\fI\f(CI\*(C`start_time\*(C'\fI\fR.IX Subsection "start_time".PPReturns the time when the Parser was created..PP\fI\f(CI\*(C`end_time\*(C'\fI\fR.IX Subsection "end_time".PPReturns the time when the end of \s-1TAP\s0 input was seen..PP\fI\f(CI\*(C`has_problems\*(C'\fI\fR.IX Subsection "has_problems".PP.Vb 3\&  if ( $parser\->has_problems ) {\&      ...\&  }.Ve.PPThis is a 'catch\-all' method which returns true if any tests have currentlyfailed, any \s-1TODO\s0 tests unexpectedly succeeded, or any parse errors occurred..PP\fI\f(CI\*(C`version\*(C'\fI\fR.IX Subsection "version".PP.Vb 1\&  $parser\->version;.Ve.PPOnce the parser is done, this will return the version number for theparsed \s-1TAP\s0. Version numbers were introduced with \s-1TAP\s0 version 13 so if noversion number is found version 12 is assumed..PP\fI\f(CI\*(C`exit\*(C'\fI\fR.IX Subsection "exit".PP.Vb 1\&  $parser\->exit;.Ve.PPOnce the parser is done, this will return the exit status.  If the parser ranan executable, it returns the exit status of the executable..PP\fI\f(CI\*(C`wait\*(C'\fI\fR.IX Subsection "wait".PP.Vb 1\&  $parser\->wait;.Ve.PPOnce the parser is done, this will return the wait status.  If the parser ranan executable, it returns the wait status of the executable.  Otherwise, thismererely returns the \f(CW\*(C`exit\*(C'\fR status..PP\fI\f(CI\*(C`parse_errors\*(C'\fI\fR.IX Subsection "parse_errors".PP.Vb 2\& my @errors = $parser\->parse_errors; # the parser errors\& my $errors = $parser\->parse_errors; # the number of parser_errors.Ve.PPFortunately, all \s-1TAP\s0 output is perfect.  In the event that it is not, thismethod will return parser errors.  Note that a junk line which the parser doesnot recognize is \f(CW\*(C`not\*(C'\fR an error.  This allows this parser to handle futureversions of \s-1TAP\s0.  The following are all \s-1TAP\s0 errors reported by the parser:.IP "\(bu" 4Misplaced plan.SpThe plan (for example, '1..5'), must only come at the beginning or end of the\&\s-1TAP\s0 output..IP "\(bu" 4No plan.SpGotta have a plan!.IP "\(bu" 4More than one plan.Sp.Vb 5\& 1..3\& ok 1 \- input file opened\& not ok 2 \- first line of the input valid # todo some data\& ok 3 read the rest of the file\& 1..3.Ve.SpRight.  Very funny.  Don't do that..IP "\(bu" 4Test numbers out of sequence.Sp.Vb 4\& 1..3\& ok 1 \- input file opened\& not ok 2 \- first line of the input valid # todo some data\& ok 2 read the rest of the file.Ve.SpThat last test line above should have the number '3' instead of '2'..SpNote that it's perfectly acceptable for some lines to have test numbers andothers to not have them.  However, when a test number is found, it must be insequence.  The following is also an error:.Sp.Vb 4\& 1..3\& ok 1 \- input file opened\& not ok \- first line of the input valid # todo some data\& ok 2 read the rest of the file.Ve.SpBut this is not:.Sp.Vb 4\& 1..3\& ok  \- input file opened\& not ok \- first line of the input valid # todo some data\& ok 3 read the rest of the file.Ve.PP\fI\f(CI\*(C`get_select_handles\*(C'\fI\fR.IX Subsection "get_select_handles".PPGet an a list of file handles which can be passed to \f(CW\*(C`select\*(C'\fR todetermine the readiness of this parser..PP\fI\f(CI\*(C`delete_spool\*(C'\fI\fR.IX Subsection "delete_spool".PPDelete and return the spool..PP.Vb 1\&  my $fh = $parser\->delete_spool;.Ve.SH "CALLBACKS".IX Header "CALLBACKS"As mentioned earlier, a \*(L"callback\*(R" key may be added to the\&\f(CW\*(C`TAP::Parser\*(C'\fR constructor. If present, each callback corresponding to agiven result type will be called with the result as the argument if the\&\f(CW\*(C`run\*(C'\fR method is used. The callback is expected to be a subroutinereference (or anonymous subroutine) which is invoked with the parserresult as its argument..PP.Vb 7\& my %callbacks = (\&     test    => \e&test_callback,\&     plan    => \e&plan_callback,\&     comment => \e&comment_callback,\&     bailout => \e&bailout_callback,\&     unknown => \e&unknown_callback,\& );\&\& my $aggregator = TAP::Parser::Aggregator\->new;\& foreach my $file ( @test_files ) {\&     my $parser = TAP::Parser\->new(\&         {\&             source    => $file,\&             callbacks => \e%callbacks,\&         }\&     );\&     $parser\->run;\&     $aggregator\->add( $file, $parser );\& }.Ve.PPCallbacks may also be added like this:.PP.Vb 2\& $parser\->callback( test => \e&test_callback );\& $parser\->callback( plan => \e&plan_callback );.Ve.PPThe following keys allowed for callbacks. These keys are case-sensitive..IP "\(bu" 4\&\f(CW\*(C`test\*(C'\fR.SpInvoked if \f(CW\*(C`$result\->is_test\*(C'\fR returns true..IP "\(bu" 4\&\f(CW\*(C`version\*(C'\fR.SpInvoked if \f(CW\*(C`$result\->is_version\*(C'\fR returns true..IP "\(bu" 4\&\f(CW\*(C`plan\*(C'\fR.SpInvoked if \f(CW\*(C`$result\->is_plan\*(C'\fR returns true..IP "\(bu" 4\&\f(CW\*(C`comment\*(C'\fR.SpInvoked if \f(CW\*(C`$result\->is_comment\*(C'\fR returns true..IP "\(bu" 4\&\f(CW\*(C`bailout\*(C'\fR.SpInvoked if \f(CW\*(C`$result\->is_unknown\*(C'\fR returns true..IP "\(bu" 4\&\f(CW\*(C`yaml\*(C'\fR.SpInvoked if \f(CW\*(C`$result\->is_yaml\*(C'\fR returns true..IP "\(bu" 4\&\f(CW\*(C`unknown\*(C'\fR.SpInvoked if \f(CW\*(C`$result\->is_unknown\*(C'\fR returns true..IP "\(bu" 4\&\f(CW\*(C`ELSE\*(C'\fR.SpIf a result does not have a callback defined for it, this callback willbe invoked. Thus, if all of the previous result types are specified ascallbacks, this callback will \fInever\fR be invoked..IP "\(bu" 4\&\f(CW\*(C`ALL\*(C'\fR.SpThis callback will always be invoked and this will happen for eachresult after one of the above callbacks is invoked.  For example, ifTerm::ANSIColor is loaded, you could use the following to color yourtest output:.Sp.Vb 12\& my %callbacks = (\&     test => sub {\&         my $test = shift;\&         if ( $test\->is_ok && not $test\->directive ) {\&             # normal passing test\&             print color \*(Aqgreen\*(Aq;\&         }\&         elsif ( !$test\->is_ok ) {    # even if it\*(Aqs TODO\&             print color \*(Aqwhite on_red\*(Aq;\&         }\&         elsif ( $test\->has_skip ) {\&             print color \*(Aqwhite on_blue\*(Aq;\&\&         }\&         elsif ( $test\->has_todo ) {\&             print color \*(Aqwhite\*(Aq;\&         }\&     },\&     ELSE => sub {\&         # plan, comment, and so on (anything which isn\*(Aqt a test line)\&         print color \*(Aqblack on_white\*(Aq;\&     },\&     ALL => sub {\&         # now print them\&         print shift\->as_string;\&         print color \*(Aqreset\*(Aq;\&         print "\en";\&     },\& );.Ve.IP "\(bu" 4\&\f(CW\*(C`EOF\*(C'\fR.SpInvoked when there are no more lines to be parsed. Since there is noaccompanying TAP::Parser::Result object the \f(CW\*(C`TAP::Parser\*(C'\fR object ispassed instead..SH "TAP GRAMMAR".IX Header "TAP GRAMMAR"If you're looking for an \s-1EBNF\s0 grammar, see TAP::Parser::Grammar..SH "BACKWARDS COMPATABILITY".IX Header "BACKWARDS COMPATABILITY"The Perl-QA list attempted to ensure backwards compatability withTest::Harness.  However, there are some minor differences..Sh "Differences".IX Subsection "Differences".IP "\(bu" 4\&\s-1TODO\s0 plans.SpA little-known feature of Test::Harness is that it supported \s-1TODO\s0lists in the plan:.Sp.Vb 3\& 1..2 todo 2\& ok 1 \- We have liftoff\& not ok 2 \- Anti\-gravity device activated.Ve.SpUnder Test::Harness, test number 2 would \fIpass\fR because it waslisted as a \s-1TODO\s0 test on the plan line. However, we are not aware ofanyone actually using this feature and hard-coding test numbers isdiscouraged because it's very easy to add a test and break the testnumber sequence. This makes test suites very fragile. Instead, thefollowing should be used:.Sp.Vb 3\& 1..2\& ok 1 \- We have liftoff\& not ok 2 \- Anti\-gravity device activated # TODO.Ve.IP "\(bu" 4\&'Missing' tests.SpIt rarely happens, but sometimes a harness might encounter\&'missing tests:.Sp.Vb 5\& ok 1\& ok 2\& ok 15\& ok 16\& ok 17.Ve.SpTest::Harness would report tests 3\-14 as having failed. For the\&\f(CW\*(C`TAP::Parser\*(C'\fR, these tests are not considered failed because they'venever run. They're reported as parse failures (tests out of sequence)..SH "ACKNOWLEDGEMENTS".IX Header "ACKNOWLEDGEMENTS"All of the following have helped. Bug reports, patches, (im)moralsupport, or just words of encouragement have all been forthcoming..IP "\(bu" 4Michael Schwern.IP "\(bu" 4Andy Lester.IP "\(bu" 4chromatic.IP "\(bu" 4\&\s-1GEOFFR\s0.IP "\(bu" 4Shlomi Fish.IP "\(bu" 4Torsten Schoenfeld.IP "\(bu" 4Jerry Gay.IP "\(bu" 4Aristotle.IP "\(bu" 4Adam Kennedy.IP "\(bu" 4Yves Orton.IP "\(bu" 4Adrian Howard.IP "\(bu" 4Sean & Lil.IP "\(bu" 4Andreas J. Koenig.IP "\(bu" 4Florian Ragwitz.IP "\(bu" 4Corion.IP "\(bu" 4Mark Stosberg.IP "\(bu" 4Matt Kraai.SH "AUTHORS".IX Header "AUTHORS"Curtis \*(L"Ovid\*(R" Poe <ovid@cpan.org>.PPAndy Armstong <andy@hexten.net>.PPEric Wilhelm @ <ewilhelm at cpan dot org>.PPMichael Peters <mpeters at plusthree dot com>.PPLeif Eriksen <leif dot eriksen at bigpond dot com>.SH "BUGS".IX Header "BUGS"Please report any bugs or feature requests to\&\f(CW\*(C`bug\-tapx\-parser@rt.cpan.org\*(C'\fR, or through the web interface at<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=TAP\-Parser>.We will be notified, and then you'll automatically be notified ofprogress on your bug as we make changes..PPObviously, bugs which include patches are best. If you prefer, you canpatch against bleed by via anonymous checkout of the latest version:.PP.Vb 1\& svn checkout http://svn.hexten.net/tapx.Ve.SH "COPYRIGHT & LICENSE".IX Header "COPYRIGHT & LICENSE"Copyright 2006\-2008 Curtis \*(L"Ovid\*(R" Poe, all rights reserved..PPThis program is free software; you can redistribute it and/or modify itunder the same terms as Perl itself.

⌨️ 快捷键说明

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