1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
package TestFor::Code::TidyAll::Plugin::PerlCritic;
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';
sub test_main : Tests {
my $self = shift;
my $rc_file = $self->{root_dir}->child('perlcriticrc');
$rc_file->spew("only = 1\nseverity = 1\n[TestingAndDebugging::RequireUseStrict]\n");
$self->tidyall(
source => "my \$foo = 5\n",
conf => { argv => qq{--profile "$rc_file"} },
expect_error => qr/Code before strictures/,
);
$self->tidyall(
source => "use strict;\nuse warnings;\nmy \$foo = 5\n",
conf => { argv => qq{--profile "$rc_file"} },
expect_ok => 1,
);
$rc_file->spew("only = 1\nseverity = 1\n[CodeLayout::ProhibitHardTabs]\n");
$self->tidyall(
source => "my \$foo = 5\n",
conf => { argv => qq{--profile "$rc_file"} },
expect_ok => 1,
);
$self->tidyall(
source => "my \$foo = 5\n",
conf => { argv => qq{--profile "$rc_file" --badoption} },
expect_error => qr/Unknown option: badoption/
);
$rc_file->spew("badconfig = 1\n");
$self->tidyall(
source => "my \$foo = 5\n",
conf => { argv => qq{--profile "$rc_file"} },
expect_error => qr/"badconfig" is not a supported option/
);
}
1;
|