[Bps-public-commit] Test-Spelling branch, master, updated. 47897feb867f02dbf53aa42cd54cc9db1dc93266
Shawn Moore
sartak at bestpractical.com
Mon Apr 25 13:26:52 EDT 2011
The branch, master has been updated
via 47897feb867f02dbf53aa42cd54cc9db1dc93266 (commit)
from 2c7615c053a10dbcdcba3cc4e1b41cb2d8f64fa9 (commit)
Summary of changes:
lib/Test/Spelling.pm | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
- Log -----------------------------------------------------------------
commit 47897feb867f02dbf53aa42cd54cc9db1dc93266
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Apr 25 13:22:08 2011 -0400
Factor out an invalid_words_in function
diff --git a/lib/Test/Spelling.pm b/lib/Test/Spelling.pm
index 54431ee..e0048fd 100644
--- a/lib/Test/Spelling.pm
+++ b/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} = ();
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list