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

📄 tap::parser.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 3 页
字号:
.PP\fI\f(CI\*(C`is_bailout\*(C'\fI\fR.IX Subsection "is_bailout".PPIndicates whether or not this is bailout line..PP\fI\f(CI\*(C`is_yaml\*(C'\fI\fR.IX Subsection "is_yaml".PPIndicates whether or not the current item is a \s-1YAML\s0 block..PP\fI\f(CI\*(C`is_unknown\*(C'\fI\fR.IX Subsection "is_unknown".PPIndicates whether or not the current line could be parsed..PP\fI\f(CI\*(C`is_ok\*(C'\fI\fR.IX Subsection "is_ok".PP.Vb 1\&  if ( $result\->is_ok ) { ... }.Ve.PPReports whether or not a given result has passed.  Anything which is \fBnot\fR atest result returns true.  This is merely provided as a convenient shortcutwhich allows you to do this:.PP.Vb 5\& my $parser = TAP::Parser\->new( { source => $source } );\& while ( my $result = $parser\->next ) {\&     # only print failing results\&     print $result\->as_string unless $result\->is_ok;\& }.Ve.ie n .Sh """plan"" methods".el .Sh "\f(CWplan\fP methods".IX Subsection "plan methods".Vb 1\& if ( $result\->is_plan ) { ... }.Ve.PPIf the above evaluates as true, the following methods will be available on the\&\f(CW$result\fR object..PP\fI\f(CI\*(C`plan\*(C'\fI\fR.IX Subsection "plan".PP.Vb 3\&  if ( $result\->is_plan ) {\&     print $result\->plan;\&  }.Ve.PPThis is merely a synonym for \f(CW\*(C`as_string\*(C'\fR..PP\fI\f(CI\*(C`tests_planned\*(C'\fI\fR.IX Subsection "tests_planned".PP.Vb 1\&  my $planned = $result\->tests_planned;.Ve.PPReturns the number of tests planned.  For example, a plan of \f(CW1..17\fR willcause this method to return '17'..PP\fI\f(CI\*(C`directive\*(C'\fI\fR.IX Subsection "directive".PP.Vb 1\& my $directive = $result\->directive;.Ve.PPIf a \s-1SKIP\s0 directive is included with the plan, this method will return it..PP.Vb 1\& 1..0 # SKIP: why bother?.Ve.PP\fI\f(CI\*(C`explanation\*(C'\fI\fR.IX Subsection "explanation".PP.Vb 1\& my $explanation = $result\->explanation;.Ve.PPIf a \s-1SKIP\s0 directive was included with the plan, this method will return theexplanation, if any..ie n .Sh """commment"" methods".el .Sh "\f(CWcommment\fP methods".IX Subsection "commment methods".Vb 1\& if ( $result\->is_comment ) { ... }.Ve.PPIf the above evaluates as true, the following methods will be available on the\&\f(CW$result\fR object..PP\fI\f(CI\*(C`comment\*(C'\fI\fR.IX Subsection "comment".PP.Vb 4\&  if ( $result\->is_comment ) {\&      my $comment = $result\->comment;\&      print "I have something to say:  $comment";\&  }.Ve.ie n .Sh """bailout"" methods".el .Sh "\f(CWbailout\fP methods".IX Subsection "bailout methods".Vb 1\& if ( $result\->is_bailout ) { ... }.Ve.PPIf the above evaluates as true, the following methods will be available on the\&\f(CW$result\fR object..PP\fI\f(CI\*(C`explanation\*(C'\fI\fR.IX Subsection "explanation".PP.Vb 4\&  if ( $result\->is_bailout ) {\&      my $explanation = $result\->explanation;\&      print "We bailed out because ($explanation)";\&  }.Ve.PPIf, and only if, a token is a bailout token, you can get an \*(L"explanation\*(R" viathis method.  The explanation is the text after the mystical \*(L"Bail out!\*(R" wordswhich appear in the tap output..ie n .Sh """unknown"" methods".el .Sh "\f(CWunknown\fP methods".IX Subsection "unknown methods".Vb 1\& if ( $result\->is_unknown ) { ... }.Ve.PPThere are no unique methods for unknown results..ie n .Sh """test"" methods".el .Sh "\f(CWtest\fP methods".IX Subsection "test methods".Vb 1\& if ( $result\->is_test ) { ... }.Ve.PPIf the above evaluates as true, the following methods will be available on the\&\f(CW$result\fR object..PP\fI\f(CI\*(C`ok\*(C'\fI\fR.IX Subsection "ok".PP.Vb 1\&  my $ok = $result\->ok;.Ve.PPReturns the literal text of the \f(CW\*(C`ok\*(C'\fR or \f(CW\*(C`not ok\*(C'\fR status..PP\fI\f(CI\*(C`number\*(C'\fI\fR.IX Subsection "number".PP.Vb 1\&  my $test_number = $result\->number;.Ve.PPReturns the number of the test, even if the original \s-1TAP\s0 output did not supplythat number..PP\fI\f(CI\*(C`description\*(C'\fI\fR.IX Subsection "description".PP.Vb 1\&  my $description = $result\->description;.Ve.PPReturns the description of the test, if any.  This is the portion after thetest number but before the directive..PP\fI\f(CI\*(C`directive\*(C'\fI\fR.IX Subsection "directive".PP.Vb 1\&  my $directive = $result\->directive;.Ve.PPReturns either \f(CW\*(C`TODO\*(C'\fR or \f(CW\*(C`SKIP\*(C'\fR if either directive was present for a testline..PP\fI\f(CI\*(C`explanation\*(C'\fI\fR.IX Subsection "explanation".PP.Vb 1\&  my $explanation = $result\->explanation;.Ve.PPIf a test had either a \f(CW\*(C`TODO\*(C'\fR or \f(CW\*(C`SKIP\*(C'\fR directive, this method will returnthe accompanying explantion, if present..PP.Vb 1\&  not ok 17 \- \*(AqPigs can fly\*(Aq # TODO not enough acid.Ve.PPFor the above line, the explanation is \fInot enough acid\fR..PP\fI\f(CI\*(C`is_ok\*(C'\fI\fR.IX Subsection "is_ok".PP.Vb 1\&  if ( $result\->is_ok ) { ... }.Ve.PPReturns a boolean value indicating whether or not the test passed.  Rememberthat for \s-1TODO\s0 tests, the test always passes..PP\&\fBNote:\fR  this was formerly \f(CW\*(C`passed\*(C'\fR.  The latter method is deprecated andwill issue a warning..PP\fI\f(CI\*(C`is_actual_ok\*(C'\fI\fR.IX Subsection "is_actual_ok".PP.Vb 1\&  if ( $result\->is_actual_ok ) { ... }.Ve.PPReturns a boolean value indicating whether or not the test passed, regardlessof its \s-1TODO\s0 status..PP\&\fBNote:\fR  this was formerly \f(CW\*(C`actual_passed\*(C'\fR.  The latter method is deprecatedand will issue a warning..PP\fI\f(CI\*(C`is_unplanned\*(C'\fI\fR.IX Subsection "is_unplanned".PP.Vb 1\&  if ( $test\->is_unplanned ) { ... }.Ve.PPIf a test number is greater than the number of planned tests, this method willreturn true.  Unplanned tests will \fIalways\fR return false for \f(CW\*(C`is_ok\*(C'\fR,regardless of whether or not the test \f(CW\*(C`has_todo\*(C'\fR (seeTAP::Parser::Result::Test for more information about this)..PP\fI\f(CI\*(C`has_skip\*(C'\fI\fR.IX Subsection "has_skip".PP.Vb 1\&  if ( $result\->has_skip ) { ... }.Ve.PPReturns a boolean value indicating whether or not this test had a \s-1SKIP\s0directive..PP\fI\f(CI\*(C`has_todo\*(C'\fI\fR.IX Subsection "has_todo".PP.Vb 1\&  if ( $result\->has_todo ) { ... }.Ve.PPReturns a boolean value indicating whether or not this test had a \s-1TODO\s0directive..PPNote that \s-1TODO\s0 tests \fIalways\fR pass.  If you need to know whether or notthey really passed, check the \f(CW\*(C`is_actual_ok\*(C'\fR method..PP\fI\f(CI\*(C`in_todo\*(C'\fI\fR.IX Subsection "in_todo".PP.Vb 1\&  if ( $parser\->in_todo ) { ... }.Ve.PPTrue while the most recent result was a \s-1TODO\s0. Becomes true before the\&\s-1TODO\s0 result is returned and stays true until just before the next non\-\&\s-1TODO\s0 test is returned..SH "TOTAL RESULTS".IX Header "TOTAL RESULTS"After parsing the \s-1TAP\s0, there are many methods available to let you dig throughthe results and determine what is meaningful to you..Sh "Individual Results".IX Subsection "Individual Results"These results refer to individual tests which are run..PP\fI\f(CI\*(C`passed\*(C'\fI\fR.IX Subsection "passed".PP.Vb 2\& my @passed = $parser\->passed; # the test numbers which passed\& my $passed = $parser\->passed; # the number of tests which passed.Ve.PPThis method lets you know which (or how many) tests passed.  If a test failedbut had a \s-1TODO\s0 directive, it will be counted as a passed test..PP\fI\f(CI\*(C`failed\*(C'\fI\fR.IX Subsection "failed".PP.Vb 2\& my @failed = $parser\->failed; # the test numbers which failed\& my $failed = $parser\->failed; # the number of tests which failed.Ve.PPThis method lets you know which (or how many) tests failed.  If a test passedbut had a \s-1TODO\s0 directive, it will \fB\s-1NOT\s0\fR be counted as a failed test..PP\fI\f(CI\*(C`actual_passed\*(C'\fI\fR.IX Subsection "actual_passed".PP.Vb 2\& # the test numbers which actually passed\& my @actual_passed = $parser\->actual_passed;\&\& # the number of tests which actually passed\& my $actual_passed = $parser\->actual_passed;.Ve.PPThis method lets you know which (or how many) tests actually passed,regardless of whether or not a \s-1TODO\s0 directive was found..PP\fI\f(CI\*(C`actual_ok\*(C'\fI\fR.IX Subsection "actual_ok".PPThis method is a synonym for \f(CW\*(C`actual_passed\*(C'\fR..PP\fI\f(CI\*(C`actual_failed\*(C'\fI\fR.IX Subsection "actual_failed".PP.Vb 2\& # the test numbers which actually failed\& my @actual_failed = $parser\->actual_failed;\&\& # the number of tests which actually failed\& my $actual_failed = $parser\->actual_failed;.Ve.PPThis method lets you know which (or how many) tests actually failed,regardless of whether or not a \s-1TODO\s0 directive was found..PP\fI\f(CI\*(C`todo\*(C'\fI\fR.IX Subsection "todo".PP.Vb 2\& my @todo = $parser\->todo; # the test numbers with todo directives\& my $todo = $parser\->todo; # the number of tests with todo directives.Ve.PPThis method lets you know which (or how many) tests had \s-1TODO\s0 directives..PP\fI\f(CI\*(C`todo_passed\*(C'\fI\fR.IX Subsection "todo_passed".PP.Vb 2\& # the test numbers which unexpectedly succeeded\& my @todo_passed = $parser\->todo_passed;\&\& # the number of tests which unexpectedly succeeded\& my $todo_passed = $parser\->todo_passed;.Ve.PPThis method lets you know which (or how many) tests actually passed but weredeclared as \*(L"\s-1TODO\s0\*(R" tests..PP\fI\f(CI\*(C`todo_failed\*(C'\fI\fR.IX Subsection "todo_failed".PP.Vb 1\&  # deprecated in favor of \*(Aqtodo_passed\*(Aq.  This method was horribly misnamed..Ve.PPThis was a badly misnamed method.  It indicates which \s-1TODO\s0 tests unexpectedlysucceeded.  Will now issue a warning and call \f(CW\*(C`todo_passed\*(C'\fR..PP\fI\f(CI\*(C`skipped\*(C'\fI\fR.IX Subsection "skipped".PP.Vb 2\& my @skipped = $parser\->skipped; # the test numbers with SKIP directives\& my $skipped = $parser\->skipped; # the number of tests with SKIP directives.Ve.PPThis method lets you know which (or how many) tests had \s-1SKIP\s0 directives..Sh "Summary Results".IX Subsection "Summary Results"These results are \*(L"meta\*(R" information about the total results of an individualtest program..PP\fI\f(CI\*(C`plan\*(C'\fI\fR.IX Subsection "plan".PP.Vb 1\& my $plan = $parser\->plan;.Ve.PPReturns the test plan, if found..PP\fI\f(CI\*(C`good_plan\*(C'\fI\fR.IX Subsection "good_plan".PPDeprecated.  Use \f(CW\*(C`is_good_plan\*(C'\fR instead..PP\fI\f(CI\*(C`is_good_plan\*(C'\fI\fR.IX Subsection "is_good_plan".PP.Vb 1\&  if ( $parser\->is_good_plan ) { ... }.Ve.PP

⌨️ 快捷键说明

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