use strict;
use t::Policy::Util qw/fetch_violations/;
my $class_name = 'ControlStructures::ProhibitLabelsWithSpecialBlockNames';
filters {
params => [qw/eval/],
};
for my $block (blocks) {
my $violations = fetch_violations($class_name, $block->input, $block->params);
is scalar @$violations, $block->failures, $block->dscr;
}
done_testing;
__DATA__
===
--- dscr: Basic passing
--- failures: 0
--- params:
--- input
BEGIN { $x = 1; }
END { $x = 1; }
CHECK { $x = 1; }
INIT { $x = 1; }
UNITCHECK { $x = 1; }
===
--- dscr: Failure, cuddled colon
--- failures: 5
--- params:
--- input
BEGIN: { $x = 1; }
END: { $x = 1; }
CHECK: { $x = 1; }
INIT: { $x = 1; }
UNITCHECK: { $x = 1; }
===
--- dscr: Failure, uncuddled colon
--- failures: 5
--- params:
--- input
BEGIN : { $x = 1; }
END : { $x = 1; }
CHECK : { $x = 1; }
INIT : { $x = 1; }
UNITCHECK : { $x = 1; }
===
--- dscr: no lint
--- failures: 4
--- params:
--- input
BEGIN: { $x = 1; }
END: { $x = 1; }
CHECK: { $x = 1; } ## no lint
INIT: { $x = 1; }
UNITCHECK: { $x = 1; }