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

📄 test::more.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 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::More 3".TH Test::More 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::More \- yet another framework for writing test scripts.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 5\&  use Test::More tests => 23;\&  # or\&  use Test::More qw(no_plan);\&  # or\&  use Test::More skip_all => $reason;\&\&  BEGIN { use_ok( \*(AqSome::Module\*(Aq ); }\&  require_ok( \*(AqSome::Module\*(Aq );\&\&  # Various ways to say "ok"\&  ok($got eq $expected, $test_name);\&\&  is  ($got, $expected, $test_name);\&  isnt($got, $expected, $test_name);\&\&  # Rather than print STDERR "# here\*(Aqs what went wrong\en"\&  diag("here\*(Aqs what went wrong");\&\&  like  ($got, qr/expected/, $test_name);\&  unlike($got, qr/expected/, $test_name);\&\&  cmp_ok($got, \*(Aq==\*(Aq, $expected, $test_name);\&\&  is_deeply($got_complex_structure, $expected_complex_structure, $test_name);\&\&  SKIP: {\&      skip $why, $how_many unless $have_some_feature;\&\&      ok( foo(),       $test_name );\&      is( foo(42), 23, $test_name );\&  };\&\&  TODO: {\&      local $TODO = $why;\&\&      ok( foo(),       $test_name );\&      is( foo(42), 23, $test_name );\&  };\&\&  can_ok($module, @methods);\&  isa_ok($object, $class);\&\&  pass($test_name);\&  fail($test_name);\&\&  BAIL_OUT($why);\&\&  # UNIMPLEMENTED!!!\&  my @status = Test::More::status;.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"\&\fB\s-1STOP\s0!\fR If you're just getting started writing tests, have a look atTest::Simple first.  This is a drop in replacement for Test::Simplewhich you can switch to once you get the hang of basic testing..PPThe purpose of this module is to provide a wide range of testingutilities.  Various ways to say \*(L"ok\*(R" with better diagnostics,facilities to skip tests, test future features and compare complicateddata structures.  While you can do almost anything with a simple\&\f(CW\*(C`ok()\*(C'\fR function, it doesn't provide good diagnostic output..Sh "I love it when a plan comes together".IX Subsection "I love it when a plan comes together"Before anything else, you need a testing plan.  This basically declareshow many tests your script is going to run to protect against prematurefailure..PPThe preferred way to do this is to declare a plan when you \f(CW\*(C`use Test::More\*(C'\fR..PP.Vb 1\&  use Test::More tests => 23;.Ve.PPThere are rare cases when you will not know beforehand how many testsyour script is going to run.  In this case, you can declare that youhave no plan.  (Try to avoid using this as it weakens your test.).PP.Vb 1\&  use Test::More qw(no_plan);.Ve.PP\&\fB\s-1NOTE\s0\fR: using no_plan requires a Test::Harness upgrade else it willthink everything has failed.  See \*(L"\s-1CAVEATS\s0 and \s-1NOTES\s0\*(R")..PPIn some cases, you'll want to completely skip an entire testing script..PP.Vb 1\&  use Test::More skip_all => $skip_reason;.Ve.PPYour script will declare a skip with the reason why you skipped andexit immediately with a zero (success).  See Test::Harness fordetails..PPIf you want to control what functions Test::More will export, youhave to use the 'import' option.  For example, to import everythingbut 'fail', you'd do:.PP.Vb 1\&  use Test::More tests => 23, import => [\*(Aq!fail\*(Aq];.Ve.PPAlternatively, you can use the \fIplan()\fR function.  Useful for when youhave to calculate the number of tests..PP.Vb 2\&  use Test::More;\&  plan tests => keys %Stuff * 3;.Ve.PPor for deciding between running the tests at all:.PP.Vb 7\&  use Test::More;\&  if( $^O eq \*(AqMacOS\*(Aq ) {\&      plan skip_all => \*(AqTest irrelevant on MacOS\*(Aq;\&  }\&  else {\&      plan tests => 42;\&  }.Ve.Sh "Test names".IX Subsection "Test names"By convention, each test is assigned a number in order.  This islargely done automatically for you.  However, it's often very useful toassign a name to each test.  Which would you rather see:.PP.Vb 3\&  ok 4\&  not ok 5\&  ok 6.Ve.PPor.PP.Vb 3\&  ok 4 \- basic multi\-variable\&  not ok 5 \- simple exponential\&  ok 6 \- force == mass * acceleration.Ve.PPThe later gives you some idea of what failed.  It also makes it easierto find the test in your script, simply search for \*(L"simpleexponential\*(R"..PPAll test functions take a name argument.  It's optional, but highlysuggested that you use it..Sh "I'm ok, you're not ok.".IX Subsection "I'm ok, you're not ok."The basic purpose of this module is to print out either \*(L"ok #\*(R" or \*(L"notok #\*(R" depending on if a given test succeeded or failed.  Everythingelse is just gravy..PPAll of the following print \*(L"ok\*(R" or \*(L"not ok\*(R" depending on if the testsucceeded or failed.  They all also return true or false,respectively..IP "\fBok\fR" 4.IX Item "ok".Vb 1\&  ok($got eq $expected, $test_name);.Ve.SpThis simply evaluates any expression (\f(CW\*(C`$got eq $expected\*(C'\fR is just asimple example) and uses that to determine if the test succeeded orfailed.  A true expression passes, a false one fails.  Very simple..SpFor example:.Sp.Vb 4\&    ok( $exp{9} == 81,                   \*(Aqsimple exponential\*(Aq );\&    ok( Film\->can(\*(Aqdb_Main\*(Aq),            \*(Aqset_db()\*(Aq );\&    ok( $p\->tests == 4,                  \*(Aqsaw tests\*(Aq );\&    ok( !grep !defined $_, @items,       \*(Aqitems populated\*(Aq );.Ve.Sp(Mnemonic:  \*(L"This is ok.\*(R").Sp\&\f(CW$test_name\fR is a very short description of the test that will be printedout.  It makes it very easy to find a test in your script when it failsand gives others an idea of your intentions.  \f(CW$test_name\fR is optional,but we \fBvery\fR strongly encourage its use..SpShould an \fIok()\fR fail, it will produce some diagnostics:.Sp.Vb 3\&    not ok 18 \- sufficient mucus\&    #   Failed test \*(Aqsufficient mucus\*(Aq\&    #   in foo.t at line 42..Ve.SpThis is the same as Test::Simple's \fIok()\fR routine..IP "\fBis\fR" 4.IX Item "is".PD 0.IP "\fBisnt\fR" 4.IX Item "isnt".PD.Vb 2\&  is  ( $got, $expected, $test_name );\&  isnt( $got, $expected, $test_name );.Ve.SpSimilar to \fIok()\fR, \fIis()\fR and \fIisnt()\fR compare their two argumentswith \f(CW\*(C`eq\*(C'\fR and \f(CW\*(C`ne\*(C'\fR respectively and use the result of that todetermine if the test succeeded or failed.  So these:.Sp.Vb 2\&    # Is the ultimate answer 42?

⌨️ 快捷键说明

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