From: Dave Rolsky Date: Tue, 9 Feb 2010 23:06:49 +0000 (-0600) Subject: add more author tests and tidy all of them X-Git-Tag: 0.11~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ce70009b69d0dab6da98d0df458f6d01721ba0c;p=gitmo%2FMooseX-ClassAttribute.git add more author tests and tidy all of them --- diff --git a/xt/kwalitee.t b/xt/kwalitee.t new file mode 100644 index 0000000..8189ff1 --- /dev/null +++ b/xt/kwalitee.t @@ -0,0 +1,12 @@ +use strict; +use warnings; + +use Test::More; + + +plan skip_all => 'This test is only run for the module author' + unless -d '.hg' || $ENV{IS_MAINTAINER}; + +eval { require Test::Kwalitee; Test::Kwalitee->import() }; +plan skip_all => "Test::Kwalitee needed for testing kwalitee" + if $@; diff --git a/xt/pod-coverage.t b/xt/pod-coverage.t index 03241db..4522a21 100644 --- a/xt/pod-coverage.t +++ b/xt/pod-coverage.t @@ -15,23 +15,23 @@ plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" my @modules = all_modules(); plan tests => scalar @modules; -my %trustme = - ( 'MooseX::ClassAttribute' => [ 'init_meta', 'class_has' ], - 'MooseX::ClassAttribute::Trait::Class' => [ 'compute_all_applicable_class_attributes' ], - 'MooseX::ClassAttribute::Meta::Method::Accessor' => [ '.+' ] - ); - -for my $module ( sort @modules ) -{ +my %trustme = ( + 'MooseX::ClassAttribute' => [ 'init_meta', 'class_has' ], + 'MooseX::ClassAttribute::Trait::Class' => + ['compute_all_applicable_class_attributes'], + 'MooseX::ClassAttribute::Meta::Method::Accessor' => ['.+'] +); + +for my $module ( sort @modules ) { my $trustme; - if ( $trustme{$module} ) - { + if ( $trustme{$module} ) { my $methods = join '|', @{ $trustme{$module} }; - $trustme = [ qr/^(?:$methods)/ ]; + $trustme = [qr/^(?:$methods)/]; } - pod_coverage_ok( $module, { trustme => $trustme }, - "Pod coverage for $module" - ); + pod_coverage_ok( + $module, { trustme => $trustme }, + "Pod coverage for $module" + ); } diff --git a/xt/pod-spell.t b/xt/pod-spell.t new file mode 100644 index 0000000..63d9a3e --- /dev/null +++ b/xt/pod-spell.t @@ -0,0 +1,26 @@ +use strict; +use warnings; + +use Test::More; + +eval "use Test::Spelling"; +plan skip_all => "Test::Spelling required for testing POD coverage" + if $@; + +my @stopwords; +for () { + chomp; + push @stopwords, $_ + unless /\A (?: \# | \s* \z)/msx; # skip comments, whitespace +} + +add_stopwords(@stopwords); +set_spell_cmd('aspell list -l en'); + +# This prevents a weird segfault from the aspell command - see +# https://bugs.launchpad.net/ubuntu/+source/aspell/+bug/71322 +local $ENV{LC_ALL} = 'C'; +all_pod_files_spelling_ok(); + +__DATA__ +PayPal diff --git a/xt/pod.t b/xt/pod.t index 8c9830b..9e30f41 100644 --- a/xt/pod.t +++ b/xt/pod.t @@ -3,7 +3,6 @@ use warnings; use Test::More; - plan skip_all => 'This test is only run for the module author' unless -d '.git' || $ENV{IS_MAINTAINER}; diff --git a/xt/version-numbers.t b/xt/version-numbers.t new file mode 100644 index 0000000..ecf592f --- /dev/null +++ b/xt/version-numbers.t @@ -0,0 +1,27 @@ +use strict; +use warnings; + +use File::Find::Rule; +use Module::Info; + +use Test::More; + +my %versions; +for my $pm_file ( File::Find::Rule->file->name(qr/\.pm$/)->in('lib') ) { + my $mod = Module::Info->new_from_file($pm_file); + + ( my $stripped_file = $pm_file ) =~ s{^lib/}{}; + + $versions{$stripped_file} = $mod->version; +} + +my $moose_ver = $versions{'MooseX/ClassAttribute.pm'}; + +for my $module ( grep { $_ ne 'MooseX/ClassAttribute.pm' } sort keys %versions ) { + is( + $versions{$module}, $moose_ver, + "version for $module is the same as in MooseX/ClassAttribute.pm" + ); +} + +done_testing();