background image
<< explicitly skip a set of tests | skipall >>
<< explicitly skip a set of tests | skipall >>
skip an entire block of code
SKIP: block
Test::More can cause an entire block of code not to run at all.
SKIP: {
eval { require HTML::Lint };
skip "HTML::Lint not installed", 2 if $@;
my $lint = new HTML::Lint;
isa_ok( $lint, "HTML::Lint" );
$lint->parse( $html );
is( $lint->errors, 0, "No errors found in HTML" );
}
x
if we don't have HTML::Lint, the skip() function is run.
x
skip() prevents anything further in the SKIP block to be run.
x
the number indicates how many tests you would have run.
The appropriate number of 'ok's will be output.
ok 23 # SKIP HTML::Lint not installed
ok 24 # SKIP HTML::Lint not installed