3 ##############################################################################
4 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/20_policy_podspelling.t $
5 # $Date: 2008-06-21 19:57:54 -0700 (Sat, 21 Jun 2008) $
8 ##############################################################################
13 use Test::More tests => 4;
15 # common P::C testing tools
16 use Perl::Critic::TestUtils qw(pcritique);
17 Perl::Critic::TestUtils::block_perlcriticrc();
20 my $policy = 'Documentation::PodSpelling';
23 eval {require Pod::Spell}
24 && can_determine_spell_command()
25 && can_run_spell_command();
27 sub can_determine_spell_command {
28 my $policy = Perl::Critic::Policy::Documentation::PodSpelling->new();
29 $policy->initialize_if_enabled();
31 return $policy->_get_spell_command_line();
34 sub can_run_spell_command {
35 my $policy = Perl::Critic::Policy::Documentation::PodSpelling->new();
36 $policy->initialize_if_enabled();
38 return $policy->_run_spell_command( <<'END_TEST_CODE' );
41 =head1 Test The Spell Command
48 return $can_podspell && ! Perl::Critic::Policy::Documentation::PodSpelling->got_sigpipe();
51 #-----------------------------------------------------------------------------
60 if ( eval { pcritique($policy, \$code, \%config) } ) {
61 skip 'Test environment is not English', 4
64 #-----------------------------------------------------------------------------
73 eval { pcritique($policy, \$code, \%config) },
74 can_podspell() ? 1 : undef,
78 #-----------------------------------------------------------------------------
89 eval { pcritique($policy, \$code, \%config) },
90 can_podspell() ? 1 : undef,
94 #-----------------------------------------------------------------------------
98 =for stopwords arglbargl
108 eval { pcritique($policy, \$code, \%config) },
109 can_podspell() ? 0 : undef,
113 #-----------------------------------------------------------------------------
115 $code = <<'END_PERL';
124 local $config{stop_words} = 'foo arglbargl bar';
126 eval { pcritique($policy, \$code, \%config) },
127 can_podspell() ? 0 : undef ,
134 #-----------------------------------------------------------------------------
136 # ensure we run true if this test is loaded by
137 # t/20_policy_podspelling.t_without_optional_dependencies.t
142 # cperl-indent-level: 4
144 # indent-tabs-mode: nil
145 # c-indentation-style: bsd
147 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :