[Bps-public-commit] Test-Spelling branch, master, updated. 31fca522eefe2ed94d228de1a1210608aa174e4d
Shawn Moore
sartak at bestpractical.com
Mon Apr 25 13:31:40 EDT 2011
The branch, master has been updated
via 31fca522eefe2ed94d228de1a1210608aa174e4d (commit)
from 112f0ae3a126e1a562f8330c485003d2077b310c (commit)
Summary of changes:
lib/Test/Spelling.pm | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
- Log -----------------------------------------------------------------
commit 31fca522eefe2ed94d228de1a1210608aa174e4d
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Apr 25 13:31:26 2011 -0400
Tidy
diff --git a/lib/Test/Spelling.pm b/lib/Test/Spelling.pm
index 03059e3..cd81651 100644
--- a/lib/Test/Spelling.pm
+++ b/lib/Test/Spelling.pm
@@ -1,14 +1,16 @@
package Test::Spelling;
-
use 5.006;
use strict;
use warnings;
+
+use base 'Exporter';
use Pod::Spell;
use Test::Builder;
use File::Spec;
use File::Temp;
use Carp;
-use base 'Exporter';
+
+our $VERSION = '0.12';
our @EXPORT = qw(
pod_file_spelling_ok
@@ -19,8 +21,6 @@ our @EXPORT = qw(
set_pod_file_filter
);
-our $VERSION = '0.12';
-
my $Test = Test::Builder->new;
my $Spell_cmd = 'spell';
my $file_filter = sub { 1 };
@@ -48,9 +48,9 @@ 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" );
+ if (!-f $file) {
+ $Test->ok(0, $name);
+ $Test->diag("$file does not exist");
return;
}
@@ -64,8 +64,8 @@ sub pod_file_spelling_ok {
# emit output
my $ok = !@words;
- $Test->ok( $ok, "$name");
- if ( !$ok ) {
+ $Test->ok($ok, "$name");
+ if (!$ok) {
$Test->diag("Errors:\n" . join '', @words);
}
@@ -75,32 +75,32 @@ sub pod_file_spelling_ok {
sub all_pod_files_spelling_ok {
my @files = all_pod_files(@_);
- $Test->plan( tests => scalar @files );
+ $Test->plan(tests => scalar @files);
my $ok = 1;
- foreach my $file ( @files ) {
- pod_file_spelling_ok( $file, ) or undef $ok;
+ for my $file (@files) {
+ pod_file_spelling_ok($file) or undef $ok;
}
return $ok;
}
sub all_pod_files {
my @queue = @_ ? @_ : _starting_points();
- my @pod = ();
+ my @pod;
- while ( @queue ) {
+ while (@queue) {
my $file = shift @queue;
- if ( -d $file ) {
+ if (-d $file) {
opendir my $dirhandle, $file or next;
my @newfiles = readdir $dirhandle;
closedir $dirhandle;
- @newfiles = File::Spec->no_upwards( @newfiles );
+ @newfiles = File::Spec->no_upwards(@newfiles);
@newfiles = grep { $_ ne "CVS" && $_ ne ".svn" } @newfiles;
push @queue, map "$file/$_", @newfiles;
}
- if ( -f $file ) {
+ if (-f $file) {
next unless _is_perl($file);
next unless $file_filter->($file);
push @pod, $file;
@@ -131,7 +131,6 @@ sub _is_perl {
return;
}
-
sub add_stopwords {
for (@_) {
my $word = $_;
@@ -167,7 +166,7 @@ F<spell> program.
use Test::More;
use Test::Spelling;
plan tests => $num_tests;
- pod_file_spelling_ok( $file, "POD file spelling OK" );
+ pod_file_spelling_ok($file, "POD file spelling OK");
Module authors can include the following in a F<t/pod_spell.t> file and
have C<Test::Spelling> automatically find and check all POD files in a
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list