diff -Nru libtest-useallmodules-perl-0.11/Changes libtest-useallmodules-perl-0.12/Changes --- libtest-useallmodules-perl-0.11/Changes 2009-05-08 03:20:18.000000000 +0100 +++ libtest-useallmodules-perl-0.12/Changes 2009-05-27 02:38:19.000000000 +0100 @@ -1,5 +1,9 @@ Revision history for Perl extension Test::UseAllModules. +0.12 2009/05/27 + - silenced a warnings on require (reported by Kevin Ryde #46389) + - now you can do extra tests like Test::NoWarnings with all_uses_ok + 0.11 2009/05/08 - Modules under arbitrary directories can be tested now. diff -Nru /tmp/9A3zKewY7l/libtest-useallmodules-perl-0.11/debian/changelog /tmp/51SubkI1He/libtest-useallmodules-perl-0.12/debian/changelog --- libtest-useallmodules-perl-0.11/debian/changelog 2009-06-01 12:36:14.000000000 +0100 +++ libtest-useallmodules-perl-0.12/debian/changelog 2009-06-01 12:36:14.000000000 +0100 @@ -1,3 +1,9 @@ +libtest-useallmodules-perl (0.12-1) unstable; urgency=low + + * New upstream release + + -- Ryan Niebur Wed, 27 May 2009 19:01:19 -0700 + libtest-useallmodules-perl (0.11-1) unstable; urgency=low * New upstream release diff -Nru /tmp/9A3zKewY7l/libtest-useallmodules-perl-0.11/lib/Test/UseAllModules.pm /tmp/51SubkI1He/libtest-useallmodules-perl-0.12/lib/Test/UseAllModules.pm --- libtest-useallmodules-perl-0.11/lib/Test/UseAllModules.pm 2009-05-08 03:17:09.000000000 +0100 +++ libtest-useallmodules-perl-0.12/lib/Test/UseAllModules.pm 2009-05-27 02:34:51.000000000 +0100 @@ -4,7 +4,7 @@ use warnings; use ExtUtils::Manifest qw( maniread ); -our $VERSION = '0.11'; +our $VERSION = '0.12'; use Exporter; @@ -13,7 +13,7 @@ use Test::More; -my $RULE; +my $RULE = qr{^lib/(.+)\.pm$}; sub import { shift->export_to_level(1); @@ -22,7 +22,7 @@ my @dirs = ('lib', @_); my %seen; @dirs = grep { !$seen{$_}++ } map { s|/+$||; $_ } @dirs; - $RULE = '^(?:'.(join '|', @dirs).')/(.*)\.pm\s*$'; + $RULE = '^(?:'.(join '|', @dirs).')/(.+)\.pm\s*$'; unshift @INC, @dirs; } @@ -48,19 +48,21 @@ return @modules; } +sub _planned { Test::More->builder->{Have_Plan}; } + sub all_uses_ok { unless (-f 'MANIFEST') { - plan skip_all => 'no MANIFEST'; - exit; + plan skip_all => 'no MANIFEST' unless _planned(); + return; } my @modules = _get_module_list(@_); unless (@modules) { - plan skip_all => 'no .pm files are found under the lib directory'; - exit; + plan skip_all => 'no .pm files are found under the lib directory' unless _planned(); + return; } - plan tests => scalar @modules; + plan tests => scalar @modules unless _planned(); my @failed; foreach my $module (@modules) { @@ -107,7 +109,7 @@ I'm sick of writing 00_load.t (or something like that) that'll do use_ok() for every module I write. I'm sicker of updating 00_load.t when I add another file to the distro. This module reads MANIFEST to find modules to be tested and does use_ok() for each of them. Now all you have to do is update MANIFEST. You don't have to modify the test any more (hopefully). -=head1 EXPORTED FUNCTIONS +=head1 EXPORTED FUNCTION =head2 all_uses_ok @@ -115,10 +117,30 @@ As of 0.11, you can also test modules under arbitrary directories by providing a directory list at the loading time (the word 'under' is ignored as shown above). Modules under the lib directory are always tested. +=head1 PROTECTED FUNCTION + +=head2 _get_module_list + +Returns module paths to test. This function will not be exported. If you want to use this (see below), you always need to call it by the full qualified name. + =head1 NOTES As of 0.03, this module calls BAIL_OUT of Test::More if any of the use_ok tests should fail. (Thus the following tests will be ignored. Missing or unloadable modules cause a lot of errors of the same kind.) +As of 0.12, you can add extra tests before/after all_uses_ok() if you explicitly declare test plan like this. + + use strict; + use warnings; + use Test::More; + use Test::UseAllModules; + use Test::NoWarnings; + + plan tests => Test::UseAllModules::_get_module_list() + 1; + + all_uses_ok(); + + # and extra nowarnings test + =head1 SEE ALSO There're several modules like this on the CPAN now. L and a bit confusing L try to find modules to test by traversing directories. I'm not a big fun of them as they tend to find temporary or unrelated modules as well, but they may be handier especially if you're too lazy to update MANIFEST every time. diff -Nru /tmp/9A3zKewY7l/libtest-useallmodules-perl-0.11/MANIFEST /tmp/51SubkI1He/libtest-useallmodules-perl-0.12/MANIFEST --- libtest-useallmodules-perl-0.11/MANIFEST 2009-05-08 03:20:52.000000000 +0100 +++ libtest-useallmodules-perl-0.12/MANIFEST 2009-05-27 02:41:18.000000000 +0100 @@ -9,6 +9,7 @@ t/04_under.t t/04_under_files.t t/05_except.t +t/06_require.t t/99_pod.t t/99_podcoverage.t t/MANIFESTed/lib/TestUseAllModulesTest.pm diff -Nru /tmp/9A3zKewY7l/libtest-useallmodules-perl-0.11/META.yml /tmp/51SubkI1He/libtest-useallmodules-perl-0.12/META.yml --- libtest-useallmodules-perl-0.11/META.yml 2009-05-08 03:20:52.000000000 +0100 +++ libtest-useallmodules-perl-0.12/META.yml 2009-05-27 02:41:18.000000000 +0100 @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Test-UseAllModules -version: 0.11 +version: 0.12 abstract: do use_ok() for all the MANIFESTed modules author: - Kenichi Ishigaki diff -Nru /tmp/9A3zKewY7l/libtest-useallmodules-perl-0.11/t/06_require.t /tmp/51SubkI1He/libtest-useallmodules-perl-0.12/t/06_require.t --- libtest-useallmodules-perl-0.11/t/06_require.t 1970-01-01 01:00:00.000000000 +0100 +++ libtest-useallmodules-perl-0.12/t/06_require.t 2009-05-27 02:07:40.000000000 +0100 @@ -0,0 +1,13 @@ +use strict; +use warnings; +use Test::More tests => 1; + +require Test::UseAllModules; + +my $has_warnings = 0; +{ + local $SIG{__WARN__} = sub { $has_warnings++ }; + Test::UseAllModules::_get_module_list(); +} + +ok !$has_warnings, "has no warnings";