Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Factor out an invalid_words_in function

  • Loading branch information...
commit 47897feb867f02dbf53aa42cd54cc9db1dc93266 1 parent 2c7615c
Shawn M Moore authored
Showing with 18 additions and 10 deletions.
  1. +18 −10 lib/Test/Spelling.pm
View
28 lib/Test/Spelling.pm
@@ -19,21 +19,14 @@ our @EXPORT = qw(
set_pod_file_filter
);
-our $VERSION = '0.11';
+our $VERSION = '0.12';
my $Test = Test::Builder->new;
my $Spell_cmd = 'spell';
my $file_filter = sub { 1 };
-sub pod_file_spelling_ok {
+sub invalid_words_in {
my $file = shift;
- my $name = @_ ? shift : "POD spelling for $file";
-
- if ( !-f $file ) {
- $Test->ok( 0, $name );
- $Test->diag( "$file does not exist" );
- return;
- }
my $scratch = File::Temp->new->filename;
@@ -47,8 +40,23 @@ sub pod_file_spelling_ok {
my @words = <$spellcheck_results>;
close $spellcheck_results or die;
- # clean up words, remove stopwords, select unique errors
chomp for @words;
+ return @words;
+}
+
+sub pod_file_spelling_ok {
+ my $file = shift;
+ my $name = @_ ? shift : "POD spelling for $file";
+
+ if ( !-f $file ) {
+ $Test->ok( 0, $name );
+ $Test->diag( "$file does not exist" );
+ return;
+ }
+
+ my @words = invalid_words_in($file);
+
+ # remove stopwords, select unique errors
@words = grep { !$Pod::Wordlist::Wordlist{$_} } @words;
my %seen;
@seen{@words} = ();
Please sign in to comment.
Something went wrong with that request. Please try again.