Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Factor out an invalid_words_in function

  • Loading branch information...
commit 47897feb867f02dbf53aa42cd54cc9db1dc93266 1 parent 2c7615c
Shawn M Moore authored

Showing 1 changed file with 18 additions and 10 deletions. Show diff stats Hide diff stats

  1. +18 10 lib/Test/Spelling.pm
28 lib/Test/Spelling.pm
@@ -19,21 +19,14 @@ our @EXPORT = qw(
19 19 set_pod_file_filter
20 20 );
21 21
22   -our $VERSION = '0.11';
  22 +our $VERSION = '0.12';
23 23
24 24 my $Test = Test::Builder->new;
25 25 my $Spell_cmd = 'spell';
26 26 my $file_filter = sub { 1 };
27 27
28   -sub pod_file_spelling_ok {
  28 +sub invalid_words_in {
29 29 my $file = shift;
30   - my $name = @_ ? shift : "POD spelling for $file";
31   -
32   - if ( !-f $file ) {
33   - $Test->ok( 0, $name );
34   - $Test->diag( "$file does not exist" );
35   - return;
36   - }
37 30
38 31 my $scratch = File::Temp->new->filename;
39 32
@@ -47,8 +40,23 @@ sub pod_file_spelling_ok {
47 40 my @words = <$spellcheck_results>;
48 41 close $spellcheck_results or die;
49 42
50   - # clean up words, remove stopwords, select unique errors
51 43 chomp for @words;
  44 + return @words;
  45 +}
  46 +
  47 +sub pod_file_spelling_ok {
  48 + my $file = shift;
  49 + my $name = @_ ? shift : "POD spelling for $file";
  50 +
  51 + if ( !-f $file ) {
  52 + $Test->ok( 0, $name );
  53 + $Test->diag( "$file does not exist" );
  54 + return;
  55 + }
  56 +
  57 + my @words = invalid_words_in($file);
  58 +
  59 + # remove stopwords, select unique errors
52 60 @words = grep { !$Pod::Wordlist::Wordlist{$_} } @words;
53 61 my %seen;
54 62 @seen{@words} = ();

0 comments on commit 47897fe

Please sign in to comment.
Something went wrong with that request. Please try again.