Test::Block is a Perl module that allows you to specify fine granularity test plans.
SYNOPSIS
use Test::More 'no_plan';
use Test::Block qw($Plan);
{
# This block should run exactly two tests
local $Plan = 2;
pass 'first test';
# oops. forgot second test
};
SKIP: {
local $Plan = 3;
pass('first test in second block');
skip "skip remaining tests" => $Plan;
};
ok( Test::Block->all_in_block, 'all test run in blocks' );
is( Test::Block->block_count, 2, 'two blocks ran' );
# This produces...
ok 1 - first test
not ok 2 - block expected 2 test(s) and ran 1
# Failed test (foo.pl at line 6)
ok 3 - first test in second block
ok 4 # skip skip remaining tests
ok 5 # skip skip remaining tests
ok 6 - all test run in blocks
ok 7 - two blocks ran
1..7
# Looks like you failed 1 tests of 7.
This module allows you to specify the number of expected tests at a finer level of granularity than an entire test script. It is built with Test::Builder and plays happily with Test::More and friends.
Product's homepage
Requirements:
· Perl