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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
package TestFor::Code::TidyAll::Plugin::PodSpell;
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';
use Module::Runtime qw( require_module );
use Try::Tiny;
BEGIN {
for my $mod (qw( Pod::Spell )) {
unless ( try { require_module($mod); 1 } ) {
__PACKAGE__->SKIP_CLASS("This test requires the $mod module");
return;
}
}
}
sub test_filename {'Foo.pod'}
sub test_main : Tests {
my $self = shift;
return unless $self->require_executable('ispell');
if ( $^O eq 'MSWin32' ) {
$self->builder->skip('There is no ispell on Windows');
return;
}
my $dict_file = $self->{root_dir}->child('.ispell_english');
$self->tidyall(
source => '=head SUMMARY\n\nthe quick brown fox jumped over the lazy dogs',
expect_ok => 1,
desc => 'ok',
);
$self->tidyall(
source => '=head SUMMARY\n\nthe quick browwn fox jumped over the lazeey dogs',
expect_error => qr/unrecognized words:\nbrowwn\nlazeey/,
desc => 'spelling mistakes',
);
$dict_file->spew("browwn\n");
$self->tidyall(
source => '=head SUMMARY\n\nthe quick browwn fox jumped over the lazeey dogs',
conf => { ispell_argv => "-p $dict_file" },
expect_error => qr/unrecognized words:\nlazeey/,
desc => 'spelling mistakes, one in dictionary',
);
$dict_file->spew("browwn\nlazeey\n");
$self->tidyall(
source => '=head SUMMARY\n\nthe quick browwn fox jumped over the lazeey dogs',
conf => { ispell_argv => "-p $dict_file" },
expect_ok => 1,
desc => 'spelling mistakes, all in dictionary',
);
}
1;
|