.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" 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 turned on, 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 .\" .\" 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::Most 3pm" .TH Test::Most 3pm "2014-08-03" "perl v5.18.2" "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::Most \- Most commonly needed test functions and features. .SH "VERSION" .IX Header "VERSION" Version 0.34 .SH "SYNOPSIS" .IX Header "SYNOPSIS" Instead of this: .PP .Vb 7 \& use strict; \& use warnings; \& use Test::Exception 0.88; \& use Test::Differences 0.500; \& use Test::Deep 0.106; \& use Test::Warn 0.11; \& use Test::More tests => 42; .Ve .PP You type this: .PP .Vb 1 \& use Test::Most tests => 42; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Test::Most exists to reduce boilerplate and to make your testing life easier. We provide \*(L"one stop shopping\*(R" for most commonly used testing modules. In fact, we often require the latest versions so that you get bug fixes through Test::Most and don't have to keep upgrading these modules separately. .PP This module provides you with the most commonly used testing functions, along with automatically turning on strict and warning and gives you a bit more fine-grained control over your test suite. .PP .Vb 1 \& use Test::Most tests => 4, \*(Aqdie\*(Aq; \& \& ok 1, \*(AqNormal calls to ok() should succeed\*(Aq; \& is 2, 2, \*(Aq... as should all passing tests\*(Aq; \& eq_or_diff [3], [4], \*(Aq... but failing tests should die\*(Aq; \& ok 4, \*(Aq... will never get to here\*(Aq; .Ve .PP As you can see, the \f(CW\*(C`eq_or_diff\*(C'\fR test will fail. Because 'die' is in the import list, the test program will halt at that point. .PP If you do not want strict and warnings enabled, you must explicitly disable them. Thus, you must be explicit about what you want and no longer need to worry about accidentally forgetting them. .PP .Vb 3 \& use Test::Most tests => 4; \& no strict; \& no warnings; .Ve .SH "EXPORT" .IX Header "EXPORT" All functions from the following modules will automatically be exported into your namespace: .IP "\(bu" 4 Test::More .IP "\(bu" 4 Test::Exception .IP "\(bu" 4 Test::Differences .IP "\(bu" 4 Test::Deep .IP "\(bu" 4 Test::Warn .PP Functions which are \fIoptionally\fR exported from any of those modules must be referred to by their fully-qualified name: .PP .Vb 1 \& Test::Deep::render_stack( $var, $stack ); .Ve .SH "FUNCTIONS" .IX Header "FUNCTIONS" Several other functions are also automatically exported: .ie n .SS """die_on_fail""" .el .SS "\f(CWdie_on_fail\fP" .IX Subsection "die_on_fail" .Vb 2 \& die_on_fail; \& is_deeply $foo, bar, \*(Aq... we throw an exception if this fails\*(Aq; .Ve .PP This function, if called, will cause the test program to throw a Test::Most::Exception, effectively halting the test. .ie n .SS """bail_on_fail""" .el .SS "\f(CWbail_on_fail\fP" .IX Subsection "bail_on_fail" .Vb 2 \& bail_on_fail; \& is_deeply $foo, bar, \*(Aq... we bail out if this fails\*(Aq; .Ve .PP This function, if called, will cause the test suite to \s-1\fIBAIL_OUT\s0()\fR if any tests fail after it. .ie n .SS """restore_fail""" .el .SS "\f(CWrestore_fail\fP" .IX Subsection "restore_fail" .Vb 2 \& die_on_fail; \& is_deeply $foo, bar, \*(Aq... we throw an exception if this fails\*(Aq; \& \& restore_fail; \& cmp_bag(\e@got, \e@bag, \*(Aq... we will not throw an exception if this fails\*(Aq; .Ve .PP This restores the original test failure behavior, so subsequent tests will no longer throw an exception or \s-1\fIBAIL_OUT\s0()\fR. .ie n .SS """set_failure_handler""" .el .SS "\f(CWset_failure_handler\fP" .IX Subsection "set_failure_handler" If you prefer other behavior to 'die_on_fail' or 'bail_on_fail', you can set your own failure handler: .PP .Vb 6 \& set_failure_handler( sub { \& my $builder = shift; \& if ( $builder && $builder\->{Test_Results}[\-1] =~ /critical/ ) { \& send_admin_email("critical failure in tests"); \& } \& } ); .Ve .PP It receives the \f(CW\*(C`Test::Builder\*(C'\fR instance as its only argument. .PP \&\fBImportant\fR: Note that if the failing test is the very last test run, then the \f(CW$builder\fR will likely be undefined. This is an unfortunate side effect of how \f(CW\*(C`Test::Builder\*(C'\fR has been designed. .ie n .SS """explain""" .el .SS "\f(CWexplain\fP" .IX Subsection "explain" Similar to \f(CW\*(C`note()\*(C'\fR, the output will only be seen by the user by using the \f(CW\*(C`\-v\*(C'\fR switch with \f(CW\*(C`prove\*(C'\fR or reading the raw \s-1TAP.\s0 .PP Unlike \f(CW\*(C`note()\*(C'\fR, any reference in the argument list is automatically expanded using \f(CW\*(C`Data::Dumper\*(C'\fR. Thus, instead of this: .PP .Vb 3 \& my $self = Some::Object\->new($id); \& use Data::Dumper; \& explain \*(AqI was just created\*(Aq, Dumper($self); .Ve .PP You can now just do this: .PP .Vb 2 \& my $self = Some::Object\->new($id); \& explain \*(AqI was just created: \*(Aq, $self; .Ve .PP That output will look similar to: .PP .Vb 4 \& I was just created: bless( { \& \*(Aqid\*(Aq => 2, \& \*(Aqstack\*(Aq => [] \& }, \*(AqSome::Object\*(Aq ) .Ve .PP Note that the \*(L"dumpered\*(R" output has the \f(CW\*(C`Data::Dumper\*(C'\fR variables \&\f(CW$Indent\fR, \f(CW\*(C`Sortkeys\*(C'\fR and \f(CW\*(C`Terse\*(C'\fR all set to the value of \f(CW1\fR (one). This allows for a much cleaner diagnostic output and at the present time cannot be overridden. .PP Note that Test::More's \f(CW\*(C`explain\*(C'\fR acts differently. This \f(CW\*(C`explain\*(C'\fR is equivalent to \f(CW\*(C`note explain\*(C'\fR in Test::More. .ie n .SS """show""" .el .SS "\f(CWshow\fP" .IX Subsection "show" Experimental. Just like \f(CW\*(C`explain\*(C'\fR, but also tries to show you the lexical variable names: .PP .Vb 9 \& my $var = 3; \& my @array = qw/ foo bar /; \& show $var, \e@array; \& _\|_END_\|_ \& $var = 3; \& @array = [ \& \*(Aqfoo\*(Aq, \& \*(Aqbar\*(Aq \& ]; .Ve .PP It will show \f(CW$VAR1\fR, \f(CW$VAR2\fR ... \f(CW$VAR_N\fR for every variable it cannot figure out the variable name to: .PP .Vb 5 \& my @array = qw/ foo bar /; \& show @array; \& _\|_END_\|_ \& $VAR1 = \*(Aqfoo\*(Aq; \& $VAR2 = \*(Aqbar\*(Aq; .Ve .PP Note that this relies on Data::Dumper::Names version 0.03 or greater. If this is not present, it will warn and call explain instead. Also, it can only show the names for lexical variables. Globals such as \f(CW%ENV\fR or \f(CW\*(C`%@\*(C'\fR are not accessed via PadWalker and thus cannot be shown. It would be nice to find a workaround for this. .ie n .SS """always_explain"" and ""always_show""" .el .SS "\f(CWalways_explain\fP and \f(CWalways_show\fP" .IX Subsection "always_explain and always_show" These are identical to \f(CW\*(C`explain\*(C'\fR and \f(CW\*(C`show\*(C'\fR, but like Test::More's \&\f(CW\*(C`diag\*(C'\fR function, these will always emit output, regardless of whether or not you're in verbose mode. .ie n .SS """all_done""" .el .SS "\f(CWall_done\fP" .IX Subsection "all_done" \&\fB\s-1DEPRECATED\s0\fR. Use the new \f(CW\*(C`done_testing()\*(C'\fR (added in Test::More since 0.87_01). Instead. We're leaving this in here for a long deprecation cycle. After a while, we might even start warning. .PP If the plan is specified as \f(CW\*(C`defer_plan\*(C'\fR, you may call \f(CW&all_done\fR at the end of the test with an optional test number. This lets you set the plan without knowing the plan before you run the tests. .PP If you call it without a test number, the tests will still fail if you don't get to the end of the test. This is useful if you don't want to specify a plan but the tests exit unexpectedly. For example, the following would \&\fIpass\fR with \f(CW\*(C`no_plan\*(C'\fR but fails with \f(CW\*(C`all_done\*(C'\fR. .PP .Vb 5 \& use Test::More \*(Aqdefer_plan\*(Aq; \& ok 1; \& exit; \& ok 2; \& all_done; .Ve .PP See \*(L"Deferred plans\*(R" for more information. .SH "EXPORT ON DEMAND" .IX Header "EXPORT ON DEMAND" The following will be exported only if requested: .ie n .SS """timeit""" .el .SS "\f(CWtimeit\fP" .IX Subsection "timeit" Prototype: \f(CW\*(C`timeit(&;$)\*(C'\fR .PP This function will warn if \f(CW\*(C`Time::HiRes\*(C'\fR is not installed. The test will still be run, but no timing information will be displayed. .PP .Vb 4 \& use Test::Most \*(Aqtimeit\*(Aq; \& timeit { is expensive_function(), $some_value, $message } \& "expensive_function()"; \& timeit { is expensive_function(), $some_value, $message }; .Ve .PP \&\f(CW\*(C`timeit\*(C'\fR accepts a code reference and an optional message. After the test is run, will \f(CW\*(C`explain\*(C'\fR the time of the function using \f(CW\*(C`Time::HiRes\*(C'\fR. If a message is supplied, it will be formatted as: .PP .Vb 1 \& sprintf "$message: took %s seconds" => $time; .Ve .PP Otherwise, it will be formatted as: .PP .Vb 1 \& sprintf "$filename line $line: took %s seconds" => $time; .Ve .SH "DIE OR BAIL ON FAIL" .IX Header "DIE OR BAIL ON FAIL" Sometimes you want your test suite to throw an exception or \s-1\fIBAIL_OUT\s0()\fR if a test fails. In order to provide maximum flexibility, there are three ways to accomplish each of these. .SS "Import list" .IX Subsection "Import list" .Vb 2 \& use Test::Most \*(Aqdie\*(Aq, tests => 7; \& use Test::Most qw< no_plan bail >; .Ve .PP If \f(CW\*(C`die\*(C'\fR or \f(CW\*(C`bail\*(C'\fR is anywhere in the import list, the test program/suite will throw a \f(CW\*(C`Test::Most::Exception\*(C'\fR or \f(CW\*(C`BAIL_OUT()\*(C'\fR as appropriate the first time a test fails. Calling \f(CW\*(C`restore_fail\*(C'\fR anywhere in the test program will restore the original behavior (not throwing an exception or bailing out). .SS "Functions" .IX Subsection "Functions" .Vb 2 \& use Test::Most \*(Aqno_plan\*(Aq; \& ok $bar, \*(AqThe test suite will continue if this passes\*(Aq; \& \& die_on_fail; \& is_deeply $foo, bar, \*(Aq... we throw an exception if this fails\*(Aq; \& \& restore_fail; \& ok $baz, \*(AqThe test suite will continue if this passes\*(Aq; .Ve .PP The \f(CW\*(C`die_on_fail\*(C'\fR and \f(CW\*(C`bail_on_fail\*(C'\fR functions will automatically set the desired behavior at runtime. .SS "Environment variables" .IX Subsection "Environment variables" .Vb 2 \& DIE_ON_FAIL=1 prove t/ \& BAIL_ON_FAIL=1 prove t/ .Ve .PP If the \f(CW\*(C`DIE_ON_FAIL\*(C'\fR or \f(CW\*(C`BAIL_ON_FAIL\*(C'\fR environment variables are true, any tests which use \f(CW\*(C`Test::Most\*(C'\fR will throw an exception or call \s-1BAIL_OUT\s0 on test failure. .SH "MISCELLANEOUS" .IX Header "MISCELLANEOUS" .SS "Moose" .IX Subsection "Moose" It used to be that this module would produce a warning when used with Moose: .PP .Vb 1 \& Prototype mismatch: sub main::blessed ($) vs none .Ve .PP This was because Test::Deep exported a \f(CW\*(C`blessed()\*(C'\fR function by default, but its prototype did not match the Moose version's prototype. We now exclude the Test::Deep version by default. If you need it, you can call the fully-qualified version or request it on the command line: .PP .Vb 1 \& use Test::Most \*(Aqblessed\*(Aq; .Ve .PP Note that as of version \f(CW0.34\fR, \f(CW\*(C`reftype\*(C'\fR is also excluded from \&\f(CW\*(C`Test::Deep\*(C'\fR's import list. This was causing issues with people trying to use \&\f(CW\*(C`Scalar::Util\*(C'\fR's \f(CW\*(C`reftype\*(C'\fR function. .SS "Excluding Test Modules" .IX Subsection "Excluding Test Modules" Sometimes you want a exclude a particular test module. For example, Test::Deep, when used with Moose, produces the following warning: .PP .Vb 1 \& Prototype mismatch: sub main::blessed ($) vs none .Ve .PP You can exclude this with by adding the module to the import list with a '\-' symbol in front: .PP .Vb 1 \& use Test::Most tests => 42, \*(Aq\-Test::Deep\*(Aq; .Ve .PP See for more information. .SS "Excluding Test Symbols" .IX Subsection "Excluding Test Symbols" Sometimes you don't want to exclude an entire test module, but just a particular symbol that is causing issues You can exclude the symbol(s) in the standard way, by specifying the symbol in the import list with a '!' in front: .PP .Vb 1 \& use Test::Most tests => 42, \*(Aq!throws_ok\*(Aq; .Ve .SS "Deferred plans" .IX Subsection "Deferred plans" \&\fB\s-1DEPRECATED\s0\fR and will be removed in some future release of this module. Using \f(CW\*(C`defer_plan\*(C'\fR will \f(CW\*(C`carp()\*(C'\fR. Use \f(CW\*(C`done_testing()\*(C'\fR from Test::More instead. .PP .Vb 4 \& use Test::Most qw; \& use My::Tests; \& my $test_count = My::Tests\->run; \& all_done($test_count); .Ve .PP Sometimes it's difficult to know the plan up front, but you can calculate the plan as your tests run. As a result, you want to defer the plan until the end of the test. Typically, the best you can do is this: .PP .Vb 3 \& use Test::More \*(Aqno_plan\*(Aq; \& use My::Tests; \& My::Tests\->run; .Ve .PP But when you do that, \f(CW\*(C`Test::Builder\*(C'\fR merely asserts that the number of tests you \fIran\fR is the number of tests. Until now, there was no way of asserting that the number of tests you \fIexpected\fR is the number of tests unless you do so before any tests have run. This fixes that problem. .SS "One-stop shopping" .IX Subsection "One-stop shopping" We generally require the latest stable versions of various test modules. Why? Because they have bug fixes and new features. You don't want to have to keep remembering them, so periodically we'll release new versions of Test::Most just for bug fixes. .ie n .SS """use ok""" .el .SS "\f(CWuse ok\fP" .IX Subsection "use ok" We do not bundle Test::use::ok, though it's been requested. That's because \&\f(CW\*(C`use_ok\*(C'\fR is broken, but Test::use::ok is also subtly broken (and a touch harder to fix). See for more information. .PP If you want to test if you can use a module, just use it. If it fails, the test will still fail and that's the desired result. .SH "RATIONALE" .IX Header "RATIONALE" People want more control over their test suites. Sometimes when you see hundreds of tests failing and whizzing by, you want the test suite to simply halt on the first failure. This module gives you that control. .PP As for the reasons for the four test modules chosen, I ran code over a local copy of the \s-1CPAN\s0 to find the most commonly used testing modules. Here's the top twenty as of January 2010 (the numbers are different because we're now counting distributions which use a given module rather than simply the number of times a module is used). .PP .Vb 10 \& 1 Test::More 14111 \& 2 Test 1736 \& 3 Test::Exception 744 \& 4 Test::Simple 331 \& 5 Test::Pod 328 \& 6 Test::Pod::Coverage 274 \& 7 Test::Perl::Critic 248 \& 8 Test::Base 228 \& 9 Test::NoWarnings 155 \& 10 Test::Distribution 142 \& 11 Test::Kwalitee 138 \& 12 Test::Deep 128 \& 13 Test::Warn 127 \& 14 Test::Differences 102 \& 15 Test::Spelling 101 \& 16 Test::MockObject 87 \& 17 Test::Builder::Tester 84 \& 18 Test::WWW::Mechanize::Catalyst 79 \& 19 Test::UseAllModules 63 \& 20 Test::YAML::Meta 61 .Ve .PP Test::Most is number 24 on that list, if you're curious. See . .PP The modules chosen seemed the best fit for what \f(CW\*(C`Test::Most\*(C'\fR is trying to do. As of 0.02, we've added Test::Warn by request. It's not in the top ten, but it's a great and useful module. .SH "AUTHOR" .IX Header "AUTHOR" Curtis Poe, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-test\-extended at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Test::Most .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .SH "TODO" .IX Header "TODO" .SS "Deferred plans" .IX Subsection "Deferred plans" Sometimes you don't know the number of tests you will run when you use \&\f(CW\*(C`Test::More\*(C'\fR. The \f(CW\*(C`plan()\*(C'\fR function allows you to delay specifying the plan, but you must still call it before the tests are run. This is an error: .PP .Vb 1 \& use Test::More; \& \& my $tests = 0; \& foreach my $test ( \& my $count = run($test); # assumes tests are being run \& $tests += $count; \& } \& plan($tests); .Ve .PP The way around this is typically to use 'no_plan' and when the tests are done, \&\f(CW\*(C`Test::Builder\*(C'\fR merely sets the plan to the number of tests run. We'd like for the programmer to specify this number instead of letting \f(CW\*(C`Test::Builder\*(C'\fR do it. However, \f(CW\*(C`Test::Builder\*(C'\fR internals are a bit difficult to work with, so we're delaying this feature. .SS "Cleaner \fIskip()\fP" .IX Subsection "Cleaner skip()" .Vb 6 \& if ( $some_condition ) { \& skip $message, $num_tests; \& } \& else { \& # run those tests \& } .Ve .PP That would be cleaner and I might add it if enough people want it. .SH "CAVEATS" .IX Header "CAVEATS" Because of how Perl handles arguments, and because diagnostics are not really part of the Test Anything Protocol, what actually happens internally is that we note that a test has failed and we throw an exception or bail out as soon as the \fInext\fR test is called (but before it runs). This means that its arguments are automatically evaluated before we can take action: .PP .Vb 1 \& use Test::Most qw; \& \& ok $foo, \*(AqDie if this fails\*(Aq; \& ok factorial(123456), \& \*(Aq... but wait a loooong time before you throw an exception\*(Aq; .Ve .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" Many thanks to \f(CW\*(C`perl\-qa\*(C'\fR for arguing about this so much that I just went ahead and did it :) .PP Thanks to Aristotle for suggesting a better way to die or bailout. .PP Thanks to 'swillert' () for suggesting a better implementation of my \*(L"dumper explain\*(R" idea (). .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2008 Curtis Poe, all rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.