Test-UseAllModules-0.14/0000755000076500007650000000000012006655151015246 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/0000755000076500007650000000000012006655150015510 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/04_under_files.t0000644000076500007650000000051212006655123020475 0ustar ishigakiishigakiuse strict; use warnings; use FindBin; use lib glob("$FindBin::Bin/extlib/*/lib"); use Test::UseAllModules under => qw(lib t/lib/); use Test::More tests => 2; BEGIN { chdir 't/MANIFESTed'; my @modules = Test::UseAllModules::_get_module_list(); ok @modules == 3; ok( !grep {$_ =~ /^under/} @modules ); chdir '../..'; } Test-UseAllModules-0.14/t/05_except.t0000644000076500007650000000051112006655123017466 0ustar ishigakiishigakiuse strict; use warnings; use FindBin; use lib glob("$FindBin::Bin/extlib/*/lib"); use Test::UseAllModules; use Test::More tests => 2; BEGIN { chdir 't/MANIFESTed'; my @modules = Test::UseAllModules::_get_module_list( except => qr/Foo/ ); ok @modules == 1; ok $modules[0] eq 'TestUseAllModulesTest'; chdir '../..'; } Test-UseAllModules-0.14/t/04_under.t0000644000076500007650000000031212006655123017311 0ustar ishigakiishigakiuse strict; use warnings; use FindBin; use lib glob("$FindBin::Bin/extlib/*/lib"); use Test::UseAllModules under => qw(lib t/lib/); BEGIN { chdir 't/MANIFESTed'; all_uses_ok(); chdir '../..'; } Test-UseAllModules-0.14/t/03_no_manifest.t0000644000076500007650000000026212006655123020501 0ustar ishigakiishigakiuse strict; use warnings; use FindBin; use lib glob("$FindBin::Bin/extlib/*/lib"); use Test::UseAllModules; BEGIN { chdir 't/NoMANIFEST'; all_uses_ok(); chdir '../..'; } Test-UseAllModules-0.14/t/MANIFESTed/0000755000076500007650000000000012006655150017227 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/MANIFESTed/t/0000755000076500007650000000000012006655150017472 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/MANIFESTed/t/lib/0000755000076500007650000000000012006655150020240 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/MANIFESTed/t/lib/TestUseAllModulesTestTest.pm0000644000076500007650000000005312006655123025652 0ustar ishigakiishigakipackage # TestUseAllModulesTestTest; 1; Test-UseAllModules-0.14/t/MANIFESTed/lib/0000755000076500007650000000000012006655150017775 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/MANIFESTed/lib/TestUseAllModulesTestFoo.pm0000644000076500007650000000005212006655123025212 0ustar ishigakiishigakipackage # TestUseAllModulesTestFoo; 1; Test-UseAllModules-0.14/t/MANIFESTed/lib/TestUseAllModulesTest.pm0000644000076500007650000000004712006655123024552 0ustar ishigakiishigakipackage # TestUseAllModulesTest; 1; Test-UseAllModules-0.14/t/MANIFESTed/MANIFEST0000644000076500007650000000020012006655123020350 0ustar ishigakiishigakilib/TestUseAllModulesTest.pm lib/TestUseAllModulesTestFoo.pm t/lib/TestUseAllModulesTestTest.pm under/TestUseAllModulesUnder.pm Test-UseAllModules-0.14/t/MANIFESTed/under/0000755000076500007650000000000012006655150020344 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/MANIFESTed/under/TestUseAllModulesUnder.pm0000644000076500007650000000005412006655123025255 0ustar ishigakiishigakipackage # TestUseAllModulesTestUnder; 1; Test-UseAllModules-0.14/t/NoMANIFEST/0000755000076500007650000000000012006655150017213 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/NoMANIFEST/lib/0000755000076500007650000000000012006655150017761 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/NoMANIFEST/lib/NeverTested.pm0000644000076500007650000000003512006655123022545 0ustar ishigakiishigakipackage # NeverTested; 1; Test-UseAllModules-0.14/t/07_extra_tests.t0000644000076500007650000000050112006655123020544 0ustar ishigakiishigakiuse strict; use warnings; use FindBin; use lib glob("$FindBin::Bin/extlib/*/lib"); use Test::More; use Test::UseAllModules under => qw(lib t/lib/); BEGIN { chdir 't/MANIFESTed'; plan tests => Test::UseAllModules::_get_module_list() + 1; all_uses_ok(); chdir '../..'; pass "test count should be correct"; } Test-UseAllModules-0.14/t/02_no_pm.t0000644000076500007650000000025412006655123017307 0ustar ishigakiishigakiuse strict; use warnings; use FindBin; use lib glob("$FindBin::Bin/extlib/*/lib"); use Test::UseAllModules; BEGIN { chdir 't/NoPM'; all_uses_ok(); chdir '../..'; } Test-UseAllModules-0.14/t/06_require.t0000644000076500007650000000045312006655123017660 0ustar ishigakiishigakiuse strict; use warnings; use FindBin; use lib glob("$FindBin::Bin/extlib/*/lib"); 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"; Test-UseAllModules-0.14/t/99_podcoverage.t0000644000076500007650000000035612006655123020520 0ustar ishigakiishigakiuse strict; use warnings; use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@; plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; all_pod_coverage_ok();Test-UseAllModules-0.14/t/NoPM/0000755000076500007650000000000012006655150016321 5ustar ishigakiishigakiTest-UseAllModules-0.14/t/NoPM/MANIFEST0000644000076500007650000000001412006655123017445 0ustar ishigakiishigakit/00_load.t Test-UseAllModules-0.14/t/99_pod.t0000644000076500007650000000032712006655123017002 0ustar ishigakiishigakiuse strict; use warnings; use Test::More; eval "use Test::Pod 1.18"; plan skip_all => 'Test::Pod 1.18 required' if $@; plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; all_pod_files_ok();Test-UseAllModules-0.14/t/01_load.t0000644000076500007650000000011712006655123017113 0ustar ishigakiishigakiuse strict; use warnings; use Test::UseAllModules; BEGIN { all_uses_ok(); } Test-UseAllModules-0.14/Makefile.PL0000644000076500007650000000116012006655123017215 0ustar ishigakiishigakiuse strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Test::UseAllModules', VERSION_FROM => 'lib/Test/UseAllModules.pm', PREREQ_PM => { 'Exporter' => 0, 'ExtUtils::Manifest' => 0, 'Test::More' => '0.60', 'Test::Builder' => '0.30', # for builder->{Have_Plan} }, ($] >= 5.005 ? (ABSTRACT_FROM => 'lib/Test/UseAllModules.pm', AUTHOR => 'Kenichi Ishigaki ') : () ), ($ExtUtils::MakeMaker::VERSION >= 6.31 ? (LICENSE => 'perl' ) : () ), ); Test-UseAllModules-0.14/META.json0000664000076500007650000000175312006655151016677 0ustar ishigakiishigaki{ "abstract" : "do use_ok() for all the MANIFESTed modules", "author" : [ "Kenichi Ishigaki " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Test-UseAllModules", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "runtime" : { "requires" : { "Exporter" : 0, "ExtUtils::Manifest" : 0, "Test::Builder" : "0.30", "Test::More" : "0.60" } } }, "release_status" : "stable", "version" : "0.14" } Test-UseAllModules-0.14/META.yml0000664000076500007650000000107712006655150016525 0ustar ishigakiishigaki--- abstract: 'do use_ok() for all the MANIFESTed modules' author: - 'Kenichi Ishigaki ' build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Test-UseAllModules no_index: directory: - t - inc requires: Exporter: 0 ExtUtils::Manifest: 0 Test::Builder: 0.30 Test::More: 0.60 version: 0.14 Test-UseAllModules-0.14/README0000644000076500007650000000051312006655123016124 0ustar ishigakiishigakiTest::UseAllModules ===================== INSTALLATION To install this module type the following: perl Makefile.PL make make test make install COPYRIGHT AND LICENCE Copyright (C) 2006 by Kenichi Ishigaki This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Test-UseAllModules-0.14/Changes0000644000076500007650000000261412006655123016543 0ustar ishigakiishigakiRevision history for Perl extension Test::UseAllModules. 0.14 2012/08/03 - Test::More version 1.5 support 0.13 2011/03/18 - Test::More version 2 support 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. 0.10 2009/02/26 - no significant code changes - updated SEE ALSO to include Test::Compile and Test::LoadAllModules 0.09_01 2008/10/01 - this is a dev release to see how PAUSE changed (by the recent security/permission issue) - minor pod tweak 0.09 2007/11/28 - added ExtUtils::Manifest dependency 0.08 2007/05/27 - maintenance release: no significant code changes - added license info to Makefile.PL - updated META.yml version 0.07 2006/07/27 - skip_all if no MANIFEST should be found. - added two tests to see if all_uses_ok skips properly. 0.06 2006/07/27 - skip_all if no .pm files should be found under the lib directory. (Tatsuhiko Miyagawa's advice) 0.05 2006/07/27 - now parses MANIFEST properly on *nix. (Tatsuhiko Miyagawa's report) 0.04 2006/07/26 - renamed from Test::Use (brian d foy's advice) 0.03 2006/07/25 - now tests will be bailed out if Test::Use test should fail. 0.02 2006/07/24 - oops. forgot to modify Makefile.PL 0.01 2006/07/24 - initial release Test-UseAllModules-0.14/lib/0000755000076500007650000000000012006655150016013 5ustar ishigakiishigakiTest-UseAllModules-0.14/lib/Test/0000755000076500007650000000000012006655150016732 5ustar ishigakiishigakiTest-UseAllModules-0.14/lib/Test/UseAllModules.pm0000644000076500007650000001057112006655123022012 0ustar ishigakiishigakipackage Test::UseAllModules; use strict; use warnings; use ExtUtils::Manifest qw( maniread ); our $VERSION = '0.14'; use Exporter; our @ISA = qw/Exporter/; our @EXPORT = qw/all_uses_ok/; use Test::More; my $RULE = qr{^lib/(.+)\.pm$}; sub import { shift->export_to_level(1); shift if @_ && $_[0] eq 'under'; my @dirs = ('lib', @_); my %seen; @dirs = grep { !$seen{$_}++ } map { s|/+$||; $_ } @dirs; $RULE = '^(?:'.(join '|', @dirs).')/(.+)\.pm\s*$'; unshift @INC, @dirs; } sub _get_module_list { shift if @_ && $_[0] eq 'except'; my @exceptions = @_; my @modules; my $manifest = maniread(); READ: foreach my $file (keys %{ $manifest }) { if (my ($module) = $file =~ m|$RULE|) { $module =~ s|/|::|g; foreach my $rule (@exceptions) { next READ if $module eq $rule || $module =~ /$rule/; } push @modules, $module; } } return @modules; } sub _planned { if ($Test::More::VERSION >= 2) { Test::More->builder->_plan_handled; } elsif ($Test::More::VERSION >= 1.005) { Test::More->builder->history->plan; } else { Test::More->builder->{Have_Plan}; } } sub all_uses_ok { unless (-f 'MANIFEST') { 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' unless _planned(); return; } plan tests => scalar @modules unless _planned(); my @failed; foreach my $module (@modules) { use_ok($module) or push @failed, $module; } BAIL_OUT( 'failed: ' . (join ',', @failed) ) if @failed; } 1; __END__ =head1 NAME Test::UseAllModules - do use_ok() for all the MANIFESTed modules =head1 SYNOPSIS # basic usage use strict; use Test::UseAllModules; BEGIN { all_uses_ok(); } # if you also want to test modules under t/lib use strict; use Test::UseAllModules under => qw(lib t/lib); BEGIN { all_uses_ok(); } # if you have modules that'll fail use_ok() for themselves use strict; use Test::UseAllModules; BEGIN { all_uses_ok except => qw( Some::Dependent::Module Another::Dependent::Module ^Yet::Another::Dependent::.* # you can use regex ) } =head1 DESCRIPTION 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 FUNCTION =head2 all_uses_ok Does Test::More's use_ok() for every module found in MANIFEST. If you have modules you don't want to test, give those modules or some regex rules as the argument. The word 'except' is ignored as shown above. 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 fan 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. =head1 AUTHOR Kenichi Ishigaki, Eishigaki@cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright (C) 2006 by Kenichi Ishigaki This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut Test-UseAllModules-0.14/MANIFEST0000644000076500007650000000121712006655151016400 0ustar ishigakiishigakiChanges lib/Test/UseAllModules.pm Makefile.PL MANIFEST This list of files README t/01_load.t t/02_no_pm.t t/03_no_manifest.t t/04_under.t t/04_under_files.t t/05_except.t t/06_require.t t/07_extra_tests.t t/99_pod.t t/99_podcoverage.t t/MANIFESTed/lib/TestUseAllModulesTest.pm t/MANIFESTed/lib/TestUseAllModulesTestFoo.pm t/MANIFESTed/MANIFEST t/MANIFESTed/t/lib/TestUseAllModulesTestTest.pm t/MANIFESTed/under/TestUseAllModulesUnder.pm t/NoMANIFEST/lib/NeverTested.pm t/NoPM/MANIFEST META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker)