r36497 - in /branches/upstream/libtest-useallmodules-perl/current: Changes MANIFEST META.yml lib/Test/UseAllModules.pm t/06_require.t

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Wed May 27 15:33:01 UTC 2009


Author: ryan52-guest
Date: Wed May 27 15:32:55 2009
New Revision: 36497

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=36497
Log:
[svn-upgrade] Integrating new upstream version, libtest-useallmodules-perl (0.12)

Added:
    branches/upstream/libtest-useallmodules-perl/current/t/06_require.t
Modified:
    branches/upstream/libtest-useallmodules-perl/current/Changes
    branches/upstream/libtest-useallmodules-perl/current/MANIFEST
    branches/upstream/libtest-useallmodules-perl/current/META.yml
    branches/upstream/libtest-useallmodules-perl/current/lib/Test/UseAllModules.pm

Modified: branches/upstream/libtest-useallmodules-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-useallmodules-perl/current/Changes?rev=36497&op=diff
==============================================================================
--- branches/upstream/libtest-useallmodules-perl/current/Changes (original)
+++ branches/upstream/libtest-useallmodules-perl/current/Changes Wed May 27 15:32:55 2009
@@ -1,4 +1,8 @@
 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.

Modified: branches/upstream/libtest-useallmodules-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-useallmodules-perl/current/MANIFEST?rev=36497&op=diff
==============================================================================
--- branches/upstream/libtest-useallmodules-perl/current/MANIFEST (original)
+++ branches/upstream/libtest-useallmodules-perl/current/MANIFEST Wed May 27 15:32:55 2009
@@ -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

Modified: branches/upstream/libtest-useallmodules-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-useallmodules-perl/current/META.yml?rev=36497&op=diff
==============================================================================
--- branches/upstream/libtest-useallmodules-perl/current/META.yml (original)
+++ branches/upstream/libtest-useallmodules-perl/current/META.yml Wed May 27 15:32:55 2009
@@ -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 <ishigaki at cpan.org>

Modified: branches/upstream/libtest-useallmodules-perl/current/lib/Test/UseAllModules.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-useallmodules-perl/current/lib/Test/UseAllModules.pm?rev=36497&op=diff
==============================================================================
--- branches/upstream/libtest-useallmodules-perl/current/lib/Test/UseAllModules.pm (original)
+++ branches/upstream/libtest-useallmodules-perl/current/lib/Test/UseAllModules.pm Wed May 27 15:32:55 2009
@@ -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,9 +117,29 @@
 
 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
 

Added: branches/upstream/libtest-useallmodules-perl/current/t/06_require.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-useallmodules-perl/current/t/06_require.t?rev=36497&op=file
==============================================================================
--- branches/upstream/libtest-useallmodules-perl/current/t/06_require.t (added)
+++ branches/upstream/libtest-useallmodules-perl/current/t/06_require.t Wed May 27 15:32:55 2009
@@ -1,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";




More information about the Pkg-perl-cvs-commits mailing list