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.^a?>~!k''T[ע93fHlNDH;;sg-@, JOs~Ss^H '"#t=^@'W~Ap'oTڭ{Fن̴1#'c>꜡?F颅B L,2~ת-s2`aHQm:F^j&~*Nūv+{sk$F~ؒ'#kNsٗ D9PqhhkctԷFIo4M=SgIu`F=#}Zi'cu!}+CZI7NuŤIe1XT xC۷hcc7 l?ziY䠩7:E>k0Vxypm?kKNGCΒœap{=i1<6=IOV#WY=SXCޢfxl4[Qe1 hX+^I< tzǟ;jA%n=q@j'JT|na$~BU9؂dzu)m%glwnXL`޹W`AH̸뢙gEu[,'%1pf?tJ Ζmc[\ZyJvn$Hl'<+5[b]v efsЁ ^. &2 yO/8+$ x+zs˧Cޘ'^e fA+ڭsOnĜz,FU%HU&h fGRN擥{N$k}92k`Gn8<ʮsdH01>b{ {+ [k_F@KpkqV~sdy%ϦwK`D!N}N#)x9nw@7y4*\ Η$sR\xts30`O<0m~%U˓5_m ôªs::kB֫.tpv쌷\R)3Vq>ٝj'r-(du @9s5`;iaqoErY${i .Z(Џs^!yCϾ˓JoKbQU{௫e.-r|XWլYkZe0AGluIɦvd7 q -jEfۭt4q +]td_+%A"zM2xlqnVdfU^QaDI?+Vi\ϙLG9r>Y {eHUqp )=sYkt,s1!r,l鄛u#I$-֐2A=A\J]&gXƛ<ns_Q(8˗#)4qY~$'3"'UYcIv s.KO!{, ($LI rDuL_߰ Ci't{2L;\ߵ7@HK.Z)4
Devil Killer Is Here MiNi Shell

MiNi SheLL

Current Path : /proc/thread-self/root/usr/local/man/man3/

Linux boscustweb5002.eigbox.net 5.4.91 #1 SMP Wed Jan 20 18:10:28 EST 2021 x86_64
Upload File :
Current File : //proc/thread-self/root/usr/local/man/man3/Test.3

.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" 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.  | will give a
.\" real vertical bar.  \*(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-|\(bv\*(Tr
.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\}
.\"
.\" 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.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" 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 3"
.TH Test 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
.SH "NAME"
Test \- provides a simple framework for writing test scripts
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\&  use strict;
\&  use Test;
.Ve
.PP
.Vb 2
\&  # use a BEGIN block so we print our plan before MyModule is loaded
\&  BEGIN { plan tests => 14, todo => [3,4] }
.Ve
.PP
.Vb 2
\&  # load your module...
\&  use MyModule;
.Ve
.PP
.Vb 2
\&  # Helpful notes.  All note-lines must start with a "#".
\&  print "# I'm testing MyModule version $MyModule::VERSION\en";
.Ve
.PP
.Vb 2
\&  ok(0); # failure
\&  ok(1); # success
.Ve
.PP
.Vb 2
\&  ok(0); # ok, expected failure (see todo list, above)
\&  ok(1); # surprise success!
.Ve
.PP
.Vb 4
\&  ok(0,1);             # failure: '0' ne '1'
\&  ok('broke','fixed'); # failure: 'broke' ne 'fixed'
\&  ok('fixed','fixed'); # success: 'fixed' eq 'fixed'
\&  ok('fixed',qr/x/);   # success: 'fixed' =~ qr/x/
.Ve
.PP
.Vb 2
\&  ok(sub { 1+1 }, 2);  # success: '2' eq '2'
\&  ok(sub { 1+1 }, 3);  # failure: '2' ne '3'
.Ve
.PP
.Vb 3
\&  my @list = (0,0);
\&  ok @list, 3, "\e@list=".join(',',@list);      #extra notes
\&  ok 'segmentation fault', '/(?i)success/';    #regex match
.Ve
.PP
.Vb 8
\&  skip(
\&    $^O =~ m/MSWin/ ? "Skip if MSWin" : 0,  # whether to skip
\&    $foo, $bar  # arguments just like for ok(...)
\&  );
\&  skip(
\&    $^O =~ m/MSWin/ ? 0 : "Skip unless MSWin",  # whether to skip
\&    $foo, $bar  # arguments just like for ok(...)
\&  );
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module simplifies the task of writing test files for Perl modules,
such that their output is in the format that
Test::Harness expects to see.
.SH "QUICK START GUIDE"
.IX Header "QUICK START GUIDE"
To write a test for your new (and probably not even done) module, create
a new file called \fIt/test.t\fR (in a new \fIt\fR directory). If you have
multiple test files, to test the \*(L"foo\*(R", \*(L"bar\*(R", and \*(L"baz\*(R" feature sets,
then feel free to call your files \fIt/foo.t\fR, \fIt/bar.t\fR, and
\&\fIt/baz.t\fR
.Sh "Functions"
.IX Subsection "Functions"
This module defines three public functions, \f(CW\*(C`plan(...)\*(C'\fR, \f(CW\*(C`ok(...)\*(C'\fR,
and \f(CW\*(C`skip(...)\*(C'\fR.  By default, all three are exported by
the \f(CW\*(C`use Test;\*(C'\fR statement.
.ie n .IP """plan(...)""" 4
.el .IP "\f(CWplan(...)\fR" 4
.IX Item "plan(...)"
.Vb 1
\&     BEGIN { plan %theplan; }
.Ve
.Sp
This should be the first thing you call in your test script.  It
declares your testing plan, how many there will be, if any of them
should be allowed to fail, and so on.
.Sp
Typical usage is just:
.Sp
.Vb 2
\&     use Test;
\&     BEGIN { plan tests => 23 }
.Ve
.Sp
These are the things that you can put in the parameters to plan:
.RS 4
.ie n .IP """tests => \f(CInumber\f(CW""" 4
.el .IP "\f(CWtests => \f(CInumber\f(CW\fR" 4
.IX Item "tests => number"
The number of tests in your script.
This means all \fIok()\fR and \fIskip()\fR calls.
.ie n .IP """todo => [\f(CI1,5,14\f(CW]""" 4
.el .IP "\f(CWtodo => [\f(CI1,5,14\f(CW]\fR" 4
.IX Item "todo => [1,5,14]"
A reference to a list of tests which are allowed to fail.
See \*(L"\s-1TODO\s0 \s-1TESTS\s0\*(R".
.ie n .IP """onfail => sub { ... }""" 4
.el .IP "\f(CWonfail => sub { ... }\fR" 4
.IX Item "onfail => sub { ... }"
.PD 0
.ie n .IP """onfail => \e&some_sub""" 4
.el .IP "\f(CWonfail => \e&some_sub\fR" 4
.IX Item "onfail => &some_sub"
.PD
A subroutine reference to be run at the end of the test script, if
any of the tests fail.  See \*(L"\s-1ONFAIL\s0\*(R".
.RE
.RS 4
.Sp
You must call \f(CW\*(C`plan(...)\*(C'\fR once and only once.  You should call it
in a \f(CW\*(C`BEGIN {...}\*(C'\fR block, like so:
.Sp
.Vb 1
\&     BEGIN { plan tests => 23 }
.Ve
.RE
.ie n .IP """ok(...)""" 4
.el .IP "\f(CWok(...)\fR" 4
.IX Item "ok(...)"
.Vb 3
\&  ok(1 + 1 == 2);
\&  ok($have, $expect);
\&  ok($have, $expect, $diagnostics);
.Ve
.Sp
This function is the reason for \f(CW\*(C`Test\*(C'\fR's existence.  It's
the basic function that
handles printing "\f(CW\*(C`ok\*(C'\fR\*(L" or \*(R"\f(CW\*(C`not ok\*(C'\fR", along with the
current test number.  (That's what \f(CW\*(C`Test::Harness\*(C'\fR wants to see.)
.Sp
In its most basic usage, \f(CW\*(C`ok(...)\*(C'\fR simply takes a single scalar
expression.  If its value is true, the test passes; if false,
the test fails.  Examples:
.Sp
.Vb 1
\&    # Examples of ok(scalar)
.Ve
.Sp
.Vb 5
\&    ok( 1 + 1 == 2 );           # ok if 1 + 1 == 2
\&    ok( $foo =~ /bar/ );        # ok if $foo contains 'bar'
\&    ok( baz($x + $y) eq 'Armondo' );    # ok if baz($x + $y) returns
\&                                        # 'Armondo'
\&    ok( @a == @b );             # ok if @a and @b are the same length
.Ve
.Sp
The expression is evaluated in scalar context.  So the following will
work:
.Sp
.Vb 3
\&    ok( @stuff );                       # ok if @stuff has any elements
\&    ok( !grep !defined $_, @stuff );    # ok if everything in @stuff is
\&                                        # defined.
.Ve
.Sp
A special case is if the expression is a subroutine reference (in either
\&\f(CW\*(C`sub {...}\*(C'\fR syntax or \f(CW\*(C`\e&foo\*(C'\fR syntax).  In
that case, it is executed and its value (true or false) determines if
the test passes or fails.  For example,
.Sp
.Vb 5
\&    ok( sub {   # See whether sleep works at least passably
\&      my $start_time = time;
\&      sleep 5;
\&      time() - $start_time  >= 4
\&    });
.Ve
.Sp
In its two-argument form, \f(CW\*(C`ok(\f(CIarg1\f(CW, \f(CIarg2\f(CW)\*(C'\fR compares the two
scalar values to see if they match.  They match if both are undefined,
or if \fIarg2\fR is a regex that matches \fIarg1\fR, or if they compare equal
with \f(CW\*(C`eq\*(C'\fR.
.Sp
.Vb 1
\&    # Example of ok(scalar, scalar)
.Ve
.Sp
.Vb 2
\&    ok( "this", "that" );               # not ok, 'this' ne 'that'
\&    ok( "", undef );                    # not ok, "" is defined
.Ve
.Sp
The second argument is considered a regex if it is either a regex
object or a string that looks like a regex.  Regex objects are
constructed with the qr// operator in recent versions of perl.  A
string is considered to look like a regex if its first and last
characters are \*(L"/\*(R", or if the first character is \*(L"m\*(R"
and its second and last characters are both the
same non-alphanumeric non-whitespace character.  These regexp
.Sp
Regex examples:
.Sp
.Vb 4
\&    ok( 'JaffO', '/Jaff/' );    # ok, 'JaffO' =~ /Jaff/
\&    ok( 'JaffO', 'm|Jaff|' );   # ok, 'JaffO' =~ m|Jaff|
\&    ok( 'JaffO', qr/Jaff/ );    # ok, 'JaffO' =~ qr/Jaff/;
\&    ok( 'JaffO', '/(?i)jaff/ ); # ok, 'JaffO' =~ /jaff/i;
.Ve
.Sp
If either (or both!) is a subroutine reference, it is run and used
as the value for comparing.  For example:
.Sp
.Vb 10
\&    ok sub {
\&        open(OUT, ">x.dat") || die $!;
\&        print OUT "\ex{e000}";
\&        close OUT;
\&        my $bytecount = -s 'x.dat';
\&        unlink 'x.dat' or warn "Can't unlink : $!";
\&        return $bytecount;
\&      },
\&      4
\&    ;
.Ve
.Sp
The above test passes two values to \f(CW\*(C`ok(arg1, arg2)\*(C'\fR \*(-- the first 
a coderef, and the second is the number 4.  Before \f(CW\*(C`ok\*(C'\fR compares them,
it calls the coderef, and uses its return value as the real value of
this parameter. Assuming that \f(CW$bytecount\fR returns 4, \f(CW\*(C`ok\*(C'\fR ends up
testing \f(CW\*(C`4 eq 4\*(C'\fR.  Since that's true, this test passes.
.Sp
Finally, you can append an optional third argument, in
\&\f(CW\*(C`ok(\f(CIarg1\f(CW,\f(CIarg2\f(CW, \f(CInote\f(CW)\*(C'\fR, where \fInote\fR is a string value that
will be printed if the test fails.  This should be some useful
information about the test, pertaining to why it failed, and/or
a description of the test.  For example:
.Sp
.Vb 4
\&    ok( grep($_ eq 'something unique', @stuff), 1,
\&        "Something that should be unique isn't!\en".
\&        '@stuff = '.join ', ', @stuff
\&      );
.Ve
.Sp
Unfortunately, a note cannot be used with the single argument
style of \f(CW\*(C`ok()\*(C'\fR.  That is, if you try \f(CW\*(C`ok(\f(CIarg1\f(CW, \f(CInote\f(CW)\*(C'\fR, then
\&\f(CW\*(C`Test\*(C'\fR will interpret this as \f(CW\*(C`ok(\f(CIarg1\f(CW, \f(CIarg2\f(CW)\*(C'\fR, and probably
end up testing \f(CW\*(C`\f(CIarg1\f(CW eq \f(CIarg2\f(CW\*(C'\fR \*(-- and that's not what you want!
.Sp
All of the above special cases can occasionally cause some
problems.  See \*(L"\s-1BUGS\s0 and \s-1CAVEATS\s0\*(R".
.ie n .IP """skip(\f(CIskip_if_true\f(CW, \f(CIargs...\f(CW)""" 4
.el .IP "\f(CWskip(\f(CIskip_if_true\f(CW, \f(CIargs...\f(CW)\fR" 4
.IX Item "skip(skip_if_true, args...)"
This is used for tests that under some conditions can be skipped.  It's
basically equivalent to:
.Sp
.Vb 5
\&  if( $skip_if_true ) {
\&    ok(1);
\&  } else {
\&    ok( args... );
\&  }
.Ve
.Sp
\&...except that the \f(CWok(1)\fR emits not just "\f(CW\*(C`ok \f(CItestnum\f(CW\*(C'\fR\*(L" but
actually \*(R"\f(CW\*(C`ok \f(CItestnum\f(CW # \f(CIskip_if_true_value\f(CW\*(C'\fR".
.Sp
The arguments after the \fIskip_if_true\fR are what is fed to \f(CW\*(C`ok(...)\*(C'\fR if
this test isn't skipped.
.Sp
Example usage:
.Sp
.Vb 2
\&  my $if_MSWin =
\&    $^O =~ m/MSWin/ ? 'Skip if under MSWin' : '';
.Ve
.Sp
.Vb 2
\&  # A test to be skipped if under MSWin (i.e., run except under MSWin)
\&  skip($if_MSWin, thing($foo), thing($bar) );
.Ve
.Sp
Or, going the other way:
.Sp
.Vb 2
\&  my $unless_MSWin =
\&    $^O =~ m/MSWin/ ? '' : 'Skip unless under MSWin';
.Ve
.Sp
.Vb 2
\&  # A test to be skipped unless under MSWin (i.e., run only under MSWin)
\&  skip($unless_MSWin, thing($foo), thing($bar) );
.Ve
.Sp
The tricky thing to remember is that the first parameter is true if
you want to \fIskip\fR the test, not \fIrun\fR it; and it also doubles as a
note about why it's being skipped. So in the first codeblock above, read
the code as "skip if MSWin \*(-- (otherwise) test whether \f(CW\*(C`thing($foo)\*(C'\fR is
\&\f(CW\*(C`thing($bar)\*(C'\fR\*(L" or for the second case, \*(R"skip unless MSWin...".
.Sp
Also, when your \fIskip_if_reason\fR string is true, it really should (for
backwards compatibility with older Test.pm versions) start with the
string \*(L"Skip\*(R", as shown in the above examples.
.Sp
Note that in the above cases, \f(CW\*(C`thing($foo)\*(C'\fR and \f(CW\*(C`thing($bar)\*(C'\fR
\&\fIare\fR evaluated \*(-- but as long as the \f(CW\*(C`skip_if_true\*(C'\fR is true,
then we \f(CW\*(C`skip(...)\*(C'\fR just tosses out their value (i.e., not
bothering to treat them like values to \f(CW\*(C`ok(...)\*(C'\fR.  But if
you need to \fInot\fR eval the arguments when skipping the
test, use
this format:
.Sp
.Vb 7
\&  skip( $unless_MSWin,
\&    sub {
\&      # This code returns true if the test passes.
\&      # (But it doesn't even get called if the test is skipped.)
\&      thing($foo) eq thing($bar)
\&    }
\&  );
.Ve
.Sp
or even this, which is basically equivalent:
.Sp
.Vb 3
\&  skip( $unless_MSWin,
\&    sub { thing($foo) }, sub { thing($bar) }
\&  );
.Ve
.Sp
That is, both are like this:
.Sp
.Vb 7
\&  if( $unless_MSWin ) {
\&    ok(1);  # but it actually appends "# $unless_MSWin"
\&            #  so that Test::Harness can tell it's a skip
\&  } else {
\&    # Not skipping, so actually call and evaluate...
\&    ok( sub { thing($foo) }, sub { thing($bar) } );
\&  }
.Ve
.SH "TEST TYPES"
.IX Header "TEST TYPES"
.IP "* \s-1NORMAL\s0 \s-1TESTS\s0" 4
.IX Item "NORMAL TESTS"
These tests are expected to succeed.  Usually, most or all of your tests
are in this category.  If a normal test doesn't succeed, then that
means that something is \fIwrong\fR.
.IP "* \s-1SKIPPED\s0 \s-1TESTS\s0" 4
.IX Item "SKIPPED TESTS"
The \f(CW\*(C`skip(...)\*(C'\fR function is for tests that might or might not be
possible to run, depending
on the availability of platform-specific features.  The first argument
should evaluate to true (think \*(L"yes, please skip\*(R") if the required
feature is \fInot\fR available.  After the first argument, \f(CW\*(C`skip(...)\*(C'\fR works
exactly the same way as \f(CW\*(C`ok(...)\*(C'\fR does.
.IP "* \s-1TODO\s0 \s-1TESTS\s0" 4
.IX Item "TODO TESTS"
\&\s-1TODO\s0 tests are designed for maintaining an \fBexecutable \s-1TODO\s0 list\fR.
These tests are \fIexpected to fail.\fR  If a \s-1TODO\s0 test does succeed,
then the feature in question shouldn't be on the \s-1TODO\s0 list, now
should it?
.Sp
Packages should \s-1NOT\s0 be released with succeeding \s-1TODO\s0 tests.  As soon
as a \s-1TODO\s0 test starts working, it should be promoted to a normal test,
and the newly working feature should be documented in the release
notes or in the change log.
.SH "ONFAIL"
.IX Header "ONFAIL"
.Vb 1
\&  BEGIN { plan test => 4, onfail => sub { warn "CALL 911!" } }
.Ve
.PP
Although test failures should be enough, extra diagnostics can be
triggered at the end of a test run.  \f(CW\*(C`onfail\*(C'\fR is passed an array ref
of hash refs that describe each test failure.  Each hash will contain
at least the following fields: \f(CW\*(C`package\*(C'\fR, \f(CW\*(C`repetition\*(C'\fR, and
\&\f(CW\*(C`result\*(C'\fR.  (You shouldn't rely on any other fields being present.)  If the test
had an expected value or a diagnostic (or \*(L"note\*(R") string, these will also be
included.
.PP
The \fIoptional\fR \f(CW\*(C`onfail\*(C'\fR hook might be used simply to print out the
version of your package and/or how to report problems.  It might also
be used to generate extremely sophisticated diagnostics for a
particularly bizarre test failure.  However it's not a panacea.  Core
dumps or other unrecoverable errors prevent the \f(CW\*(C`onfail\*(C'\fR hook from
running.  (It is run inside an \f(CW\*(C`END\*(C'\fR block.)  Besides, \f(CW\*(C`onfail\*(C'\fR is
probably over-kill in most cases.  (Your test code should be simpler
than the code it is testing, yes?)
.SH "BUGS and CAVEATS"
.IX Header "BUGS and CAVEATS"
.IP "\(bu" 4
\&\f(CW\*(C`ok(...)\*(C'\fR's special handing of strings which look like they might be
regexes can also cause unexpected behavior.  An innocent:
.Sp
.Vb 1
\&    ok( $fileglob, '/path/to/some/*stuff/' );
.Ve
.Sp
will fail, since Test.pm considers the second argument to be a regex!
The best bet is to use the one-argument form:
.Sp
.Vb 1
\&    ok( $fileglob eq '/path/to/some/*stuff/' );
.Ve
.IP "\(bu" 4
\&\f(CW\*(C`ok(...)\*(C'\fR's use of string \f(CW\*(C`eq\*(C'\fR can sometimes cause odd problems
when comparing
numbers, especially if you're casting a string to a number:
.Sp
.Vb 2
\&    $foo = "1.0";
\&    ok( $foo, 1 );      # not ok, "1.0" ne 1
.Ve
.Sp
Your best bet is to use the single argument form:
.Sp
.Vb 1
\&    ok( $foo == 1 );    # ok "1.0" == 1
.Ve
.IP "\(bu" 4
As you may have inferred from the above documentation and examples,
\&\f(CW\*(C`ok\*(C'\fR's prototype is \f(CW\*(C`($;$$)\*(C'\fR (and, incidentally, \f(CW\*(C`skip\*(C'\fR's is
\&\f(CW\*(C`($;$$$)\*(C'\fR). This means, for example, that you can do \f(CW\*(C`ok @foo, @bar\*(C'\fR
to compare the \fIsize\fR of the two arrays. But don't be fooled into
thinking that \f(CW\*(C`ok @foo, @bar\*(C'\fR means a comparison of the contents of two
arrays \*(-- you're comparing \fIjust\fR the number of elements of each. It's
so easy to make that mistake in reading \f(CW\*(C`ok @foo, @bar\*(C'\fR that you might
want to be very explicit about it, and instead write \f(CW\*(C`ok scalar(@foo),
scalar(@bar)\*(C'\fR.
.IP "\(bu" 4
This almost definitely doesn't do what you expect:
.Sp
.Vb 1
\&     ok $thingy->can('some_method');
.Ve
.Sp
Why?  Because \f(CW\*(C`can\*(C'\fR returns a coderef to mean \*(L"yes it can (and the
method is this...)\*(R", and then \f(CW\*(C`ok\*(C'\fR sees a coderef and thinks you're
passing a function that you want it to call and consider the truth of
the result of!  I.e., just like:
.Sp
.Vb 1
\&     ok $thingy->can('some_method')->();
.Ve
.Sp
What you probably want instead is this:
.Sp
.Vb 1
\&     ok $thingy->can('some_method') && 1;
.Ve
.Sp
If the \f(CW\*(C`can\*(C'\fR returns false, then that is passed to \f(CW\*(C`ok\*(C'\fR.  If it
returns true, then the larger expression \f(CW\*(C`$thingy\->can('some_method')\ &&\ 1\*(C'\fR returns 1, which \f(CW\*(C`ok\*(C'\fR sees as
a simple signal of success, as you would expect.
.IP "\(bu" 4
The syntax for \f(CW\*(C`skip\*(C'\fR is about the only way it can be, but it's still
quite confusing.  Just start with the above examples and you'll
be okay.
.Sp
Moreover, users may expect this:
.Sp
.Vb 1
\&  skip $unless_mswin, foo($bar), baz($quux);
.Ve
.Sp
to not evaluate \f(CW\*(C`foo($bar)\*(C'\fR and \f(CW\*(C`baz($quux)\*(C'\fR when the test is being
skipped.  But in reality, they \fIare\fR evaluated, but \f(CW\*(C`skip\*(C'\fR just won't
bother comparing them if \f(CW$unless_mswin\fR is true.
.Sp
You could do this:
.Sp
.Vb 1
\&  skip $unless_mswin, sub{foo($bar)}, sub{baz($quux)};
.Ve
.Sp
But that's not terribly pretty.  You may find it simpler or clearer in
the long run to just do things like this:
.Sp
.Vb 10
\&  if( $^O =~ m/MSWin/ ) {
\&    print "# Yay, we're under $^O\en";
\&    ok foo($bar), baz($quux);
\&    ok thing($whatever), baz($stuff);
\&    ok blorp($quux, $whatever);
\&    ok foo($barzbarz), thang($quux);
\&  } else {
\&    print "# Feh, we're under $^O.  Watch me skip some tests...\en";
\&    for(1 .. 4) { skip "Skip unless under MSWin" }
\&  }
.Ve
.Sp
But be quite sure that \f(CW\*(C`ok\*(C'\fR is called exactly as many times in the
first block as \f(CW\*(C`skip\*(C'\fR is called in the second block.
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
If \f(CW\*(C`PERL_TEST_DIFF\*(C'\fR environment variable is set, it will be used as a
command for comparing unexpected multiline results.  If you have \s-1GNU\s0
diff installed, you might want to set \f(CW\*(C`PERL_TEST_DIFF\*(C'\fR to \f(CW\*(C`diff \-u\*(C'\fR.
If you don't have a suitable program, you might install the
\&\f(CW\*(C`Text::Diff\*(C'\fR module and then set \f(CW\*(C`PERL_TEST_DIFF\*(C'\fR to be \f(CW\*(C`perl
\&\-MText::Diff \-e 'print diff(@ARGV)'\*(C'\fR.  If \f(CW\*(C`PERL_TEST_DIFF\*(C'\fR isn't set
but the \f(CW\*(C`Algorithm::Diff\*(C'\fR module is available, then it will be used
to show the differences in multiline results.
.SH "NOTE"
.IX Header "NOTE"
A past developer of this module once said that it was no longer being
actively developed.  However, rumors of its demise were greatly
exaggerated.  Feedback and suggestions are quite welcome.
.PP
Be aware that the main value of this module is its simplicity.  Note
that there are already more ambitious modules out there, such as
Test::More and Test::Unit.
.PP
Some earlier versions of this module had docs with some confusing
typoes in the description of \f(CW\*(C`skip(...)\*(C'\fR.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Test::Harness
.PP
Test::Simple, Test::More, Devel::Cover
.PP
Test::Builder for building your own testing library.
.PP
Test::Unit is an interesting XUnit-style testing library.
.PP
Test::Inline and SelfTest let you embed tests in code.
.SH "AUTHOR"
.IX Header "AUTHOR"
Copyright (c) 1998\-2000 Joshua Nathaniel Pritikin.  All rights reserved.
.PP
Copyright (c) 2001\-2002 Michael G. Schwern.
.PP
Copyright (c) 2002\-2004 and counting Sean M. Burke.
.PP
Current maintainer: Sean M. Burke. <sburke@cpan.org>
.PP
This package is free software and is provided \*(L"as is\*(R" without express
or implied warranty.  It may be used, redistributed and/or modified
under the same terms as Perl itself.

Creat By MiNi SheLL
Email: devilkiller@gmail.com