.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .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" '' . ds C` . ds C' '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 >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Badger::Test::Manager 3pm" .TH Badger::Test::Manager 3pm "2023-08-28" "perl v5.36.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" Badger::Test::Manager \- test manager module .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Badger::Test::Manager; \& \& # object methods \& my $manager = Badger::Test::Manager\->new( plan => 7 ); \& $manager\->ok($bool, \*(AqThis is a test\*(Aq); \& $manager\->pass(\*(AqThis is ok\*(Aq); \& $manager\->fail(\*(AqThis is not ok\*(Aq); \& $manager\->is($this, $this, \*(AqThis and that are equal\*(Aq); \& $manager\->isnt($this, $this, \*(AqThis and that are not equal\*(Aq); \& $manager\->like($this, qr/that/, \*(AqThis is matched by that\*(Aq); \& $manager\->unlike($this, qr/that/, \*(AqThis is not matched by that\*(Aq); \& \& # class methods \& Badger::Test::Manager\->plan(7); \& Badger::Test::Manager\->ok($bool, \*(AqThis is a test\*(Aq); \& Badger::Test::Manager\->pass(\*(AqThis is ok\*(Aq); \& Badger::Test::Manager\->fail(\*(AqThis is not ok\*(Aq); \& # ... plus is(), isnt(), like() unlike() methods, as above .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module implements a simple test manager for Badger::Test. .SH "METHODS" .IX Header "METHODS" All methods can be called as class methods or object methods. In the case of class methods, they are called against a prototype object returned by the \fBprototype()\fR method inherited from Badger::Prototype. .SS "plan($tests)" .IX Subsection "plan($tests)" How many tests you plan to run. An error will be thrown if you try to call this method twice. .SS "result($flag,@args)" .IX Subsection "result($flag,@args)" Low-level method to generate a test result. .ie n .SS "ok($flag, $name)" .el .SS "ok($flag, \f(CW$name\fP)" .IX Subsection "ok($flag, $name)" Report on the success or failure of a test: .PP .Vb 2 \& $manager\->ok(1, \*(AqThis is good\*(Aq); \& $manager\->ok(0, \*(AqThis is bad\*(Aq); .Ve .ie n .SS "is($this, $that, $name)" .el .SS "is($this, \f(CW$that\fP, \f(CW$name\fP)" .IX Subsection "is($this, $that, $name)" Test if the first two arguments are equal. .PP .Vb 1 \& $manager\->is($this, $that, "This and that are equal"); .Ve .ie n .SS "isnt($this, $that, $name)" .el .SS "isnt($this, \f(CW$that\fP, \f(CW$name\fP)" .IX Subsection "isnt($this, $that, $name)" Test if the first two arguments are not equal. .PP .Vb 1 \& $manager\->isnt($this, $that, "This and that are equal"); .Ve .ie n .SS "like($text, qr/regex/, $name)" .el .SS "like($text, qr/regex/, \f(CW$name\fP)" .IX Subsection "like($text, qr/regex/, $name)" Test if the first argument is matched by the regex passed as the second argument. .PP .Vb 1 \& $manager\->like($this, qr/like that/i, "This and that are alike"); .Ve .ie n .SS "unlike($text, qr/regex/, $name)" .el .SS "unlike($text, qr/regex/, \f(CW$name\fP)" .IX Subsection "unlike($text, qr/regex/, $name)" Test if the first argument is not matched by the regex passed as the second argument. .PP .Vb 1 \& $manager\->unlike($this, qr/like that/i, "This and that are unalike"); .Ve .SS "pass($name)" .IX Subsection "pass($name)" Pass a test. .PP .Vb 1 \& $manager\->pass(\*(AqModule Loaded\*(Aq); .Ve .SS "fail($name)" .IX Subsection "fail($name)" Fail a test. .PP .Vb 1 \& $manager\->fail(\*(AqStonehenge crushed by a dwarf\*(Aq); .Ve .SS "skip($reason)" .IX Subsection "skip($reason)" Skip a single test. .PP .Vb 1 \& $manager\->skip("We don\*(Aqt have that piece of scenery any more"); .Ve .SS "skip_some($number,$reason)" .IX Subsection "skip_some($number,$reason)" Skip a number of tests. .PP .Vb 1 \& $manager\->skip_some(11, "We don\*(Aqt have that piece of scenery any more"); .Ve .SS "skip_rest(,$reason)" .IX Subsection "skip_rest(,$reason)" Skip any remaining tests. .PP .Vb 1 \& $manager\->skip_rest("We don\*(Aqt have that piece of scenery any more"); .Ve .SS "skip_all($reason)" .IX Subsection "skip_all($reason)" Skip all tests. This should be called instead of \fBplan()\fR .PP .Vb 1 \& $manager\->skip_all("We don\*(Aqt have that piece of scenery any more"); .Ve .SS "colour($flag)" .IX Subsection "colour($flag)" Method to enable or disable colour mode. .SS "color($flag)" .IX Subsection "color($flag)" An alias for \fBcolour()\fR. .SH "INTERNAL METHODS" .IX Header "INTERNAL METHODS" .SS "\fBfinish()\fP" .IX Subsection "finish()" This method is called automatically when the \f(CW\*(C`Badger::Test::Manager\*(C'\fR object is destroyed. It flushes any pending tests, performs any final sanity checks and prints a summary if requested. .SS "\fBflush()\fP" .IX Subsection "flush()" This methods flushes any cached test results. You don't need to worry about it. .SS "\fBsummary()\fP" .IX Subsection "summary()" This method generates a final summary of the tests .SS "\fBtest_msg()\fP" .IX Subsection "test_msg()" Used to generate the test messages displayed via the Badger::Base \&\fBmessages()\fR method. The message formats are defined in the \f(CW$MESSAGES\fR package variable. .SS "\fBtest_name()\fP" .IX Subsection "test_name()" Use to generate a name for a test if one isn't explicitly provided. .SS "different($expect,$result)" .IX Subsection "different($expect,$result)" This method is call when a test find a result that doesn't match the expected value. If \f(CW\*(C`Algorithm::Diff\*(C'\fR is installed on your machine, it will generate a message showing how the output and expected values differ. .PP Otherwise it will generate a regular message reporting the mismatch. .SH "AUTHOR" .IX Header "AUTHOR" Andy Wardley .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 1996\-2009 Andy Wardley. All Rights Reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Badger::Test