????Perl ???????????????Test::More ???e??????????????????????????????Test::Unit?????????Test::Nginx???????????????鴴??????????????????鳣?????á?

????1???????????

????use Test::More;

??????Test::More??????????????????? testcase ?????????????????£?

????use Test::More tests => 2;

??????????????????????????????????С?

???????????????ж??????????????У????????????????

????use Test::More;   # see done_testing()

????……

??????в???????

????……

????done_testing(); or done_testing($number_of_tests_run);

????2?????? Test::More ?????????

????ok

  ok($succeeded?? $test_name);

?????÷????????ж?????????????????????????ж?????????????????????????????????$succeeded ???????????????0????????????????????????????÷?????£?

    ok( $exp{9} == 81??                   'simple exponential' );
    ok( Film->can('db_Main')??            'set_db()' );
    ok( $p->tests == 4??                  'saw tests' );
    ok( !grep !defined $_?? @items??       'items populated' );

????is/isnt

is  ( $got?? $expected?? $test_name );
is  ( $got?? $expected?? $test_name );

????is() ?? isnt()??????ok()??????????????is() ?? isnt()??????????????????????????ò????????????????????isnt()??????is()??????????÷???

    # Is the ultimate answer 42?
is( ultimate_answer()?? 42??          "Meaning of Life" );
 
    # $foo isn't empty
    isnt( $foo?? ''??     "Got some foo" );

????????ok()??????

    ok( ultimate_answer() eq 42??        "Meaning of Life" );
    ok( $foo ne ''??     "Got some foo" );

???????undef ??????undef??

????Like/ unlike

like( $got?? qr/expected/?? $test_name );
unlike( $got?? qr/expected/?? $test_name );

?????ú?????ok()????????????????????????????????????qr/expected/??unlike()?like()??????????????÷???

like($got?? qr/expected/?? 'this is like that');

???????????

ok( $got =~ /expected/?? 'this is like that');

????cmp_ok

cmp_ok( $got?? $op?? $expected?? $test_name );

????cmp_ok()??????????ok() ?? is()???÷?????????????????????????÷???

cmp_ok( $got?? 'eq'?? $expected?? 'this eq that' );
cmp_ok( $got?? '=='?? $expected?? 'this == that' );
cmp_ok( $got?? '&&'?? $expected?? 'this && that' );

????3????????????????????????

??????????????????????????????????????????debug?????????????????Щ??????????е?????????????????????????????

????diag

diag(@diagnostic_message);

?????ú????????????????????????????????. ?????в??????????????????????÷?????£?

ok( grep(/foo/?? @users)?? "There's a foo user" ) or
diag("Since there's no foo?? check that /etc/bar is set up right");

????explain

my @dump = explain @diagnostic_message;

?????ú?????????????????????????κ???????????????????diag()?????????á?