sub plan
1 | module Test |
1.1 | (Test) sub plan |
Documentation for sub plan
assembled from the following types:
module Test
From Test
(Test) sub plan
Defined as:
multi sub plan(Cool :skip-all()!)multi sub plan()
Specify the count of tests -- usually written at the beginning of a test file.
plan 15; # expect to run 15 tests
In subtest
s, plan
is used to specify the count of tests within the subtest.
If a plan
is used, it's not necessary to specify the end of testing with done-testing
.
You can also provide a :skip-all
named argument instead of a test count, to indicate that you want to skip all of the tests. Such a plan will call exit
, unless used inside of a subtest
.
plan :skip-all<These tests are only for Windows> unless .is-win;plan 1;ok dir 'C:/'; # this won't get run on non-Windows
If used in a subtest
, it will instead return
from that subtest
's Callable
. For that reason, to be able to use :skip-all
inside a subtest
, you must use a sub
instead of a regular block:
plan 2;subtest "Some Windows tests" => subok 42; # this will run everywhere and isn't affected by skip-all inside subtest
Note that plan
with :skip-all
is to avoid performing any tests without marking the test run as failed (i.e. the plan is to not run anything and that's all good). Use skip-rest
to skip all further tests, once the run has started (i.e. planned to run some tests, maybe even ran some, but now we're skipping all the rest of them). Use bail-out
to fail the test run without running any further tests (i.e. things are so bad, there's no point in running anything else; we've failed).