From: Dave Rolsky Date: Fri, 25 Dec 2009 15:58:35 +0000 (-0600) Subject: add a bunch of author-only tests X-Git-Tag: 0.22~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Singleton.git;a=commitdiff_plain;h=da16d91534c86c1062b97b75db93cc4dddad2e6e add a bunch of author-only tests --- diff --git a/xt/pod-coverage.t b/xt/pod-coverage.t new file mode 100644 index 0000000..5b5d246 --- /dev/null +++ b/xt/pod-coverage.t @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +eval "use Test::Pod::Coverage 1.04"; +plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; + +# This is a stripped down version of all_pod_coverage_ok which lets us +# vary the trustme parameter per module. +my @modules = all_modules(); +plan tests => scalar @modules; + +my %trustme = ( + 'MooseX::Singleton' => ['init_meta'], + 'MooseX::Singleton::Role::Meta::Class' => + [qw( clear_singleton existing_singleton )], + 'MooseX::Singleton::Role::Meta::Instance' => ['get_singleton_instance'], + 'MooseX::Singleton::Role::Object' => [qw( initialize instance )], +); + +for my $module ( sort @modules ) { + my $trustme = []; + if ( $trustme{$module} ) { + my $methods = join '|', @{ $trustme{$module} }; + $trustme = [qr/^(?:$methods)$/]; + } + + 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..ca2739f --- /dev/null +++ b/xt/pod-spell.t @@ -0,0 +1,19 @@ +use strict; +use warnings; + +use Test::Spelling; + +my @stopwords; +for () { + chomp; + push @stopwords, $_ + unless /\A (?: \# | \s* \z)/msx; # skip comments, whitespace +} + +add_stopwords(@stopwords); +set_spell_cmd('aspell list -l en'); +all_pod_files_spelling_ok; + +__DATA__ +metaclass +SIGNES diff --git a/xt/pod.t b/xt/pod.t new file mode 100644 index 0000000..4ae1af3 --- /dev/null +++ b/xt/pod.t @@ -0,0 +1,11 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +eval "use Test::Pod 1.14"; +plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; + +all_pod_files_ok(); diff --git a/xt/tabs.t b/xt/tabs.t new file mode 100644 index 0000000..1b9c5b9 --- /dev/null +++ b/xt/tabs.t @@ -0,0 +1,13 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +eval "use Test::NoTabs 0.8"; +plan skip_all => "Test::NoTabs 0.8 required for testing tabs" if $@; + +# Module::Install has tabs, so we can't check 'inc' or ideally '.' +all_perl_files_ok('lib', 't', 'xt'); + diff --git a/xt/version-numbers.t b/xt/version-numbers.t new file mode 100644 index 0000000..d40c091 --- /dev/null +++ b/xt/version-numbers.t @@ -0,0 +1,24 @@ +use strict; +use warnings; + +use File::Find::Rule; +use Module::Info; + +use Test::More qw( no_plan ); + + +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/Singleton.pm'}; + +for my $module ( grep { $_ ne 'MooseX/Singleton.pm' } sort keys %versions ) { + is( $versions{$module}, $moose_ver, + "version for $module is the same as in MooseX/Singleton.pm" ); +}