Test-UseAllModules-0.17/0000755000175000017500000000000012431063744015242 5ustar ishigakiishigakiTest-UseAllModules-0.17/README0000644000175000017500000000051312360265430016116 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.17/lib/0000755000175000017500000000000012431063744016010 5ustar ishigakiishigakiTest-UseAllModules-0.17/lib/Test/0000755000175000017500000000000012431063744016727 5ustar ishigakiishigakiTest-UseAllModules-0.17/lib/Test/UseAllModules.pm0000644000175000017500000001030612431063555022003 0ustar ishigakiishigakipackage Test::UseAllModules; use strict; use warnings; use ExtUtils::Manifest qw( maniread ); our $VERSION = '0.17'; 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 { Test::More->builder->has_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.17/t/0000755000175000017500000000000012431063744015505 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/04_under.t0000644000175000017500000000031212360265430017303 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.17/t/04_under_files.t0000644000175000017500000000051212360265430020467 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.17/t/07_extra_tests.t0000644000175000017500000000050112360265430020536 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.17/t/NoPM/0000755000175000017500000000000012431063744016316 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/NoPM/MANIFEST0000644000175000017500000000001412360265430017437 0ustar ishigakiishigakit/00_load.t Test-UseAllModules-0.17/t/99_pod.t0000644000175000017500000000032712360265430016774 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.17/t/01_load.t0000644000175000017500000000011712360265430017105 0ustar ishigakiishigakiuse strict; use warnings; use Test::UseAllModules; BEGIN { all_uses_ok(); } Test-UseAllModules-0.17/t/06_require.t0000644000175000017500000000045312360265430017652 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.17/t/03_no_manifest.t0000644000175000017500000000026212360265430020473 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.17/t/NoMANIFEST/0000755000175000017500000000000012431063744017210 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/NoMANIFEST/lib/0000755000175000017500000000000012431063744017756 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/NoMANIFEST/lib/NeverTested.pm0000644000175000017500000000003512360265430022537 0ustar ishigakiishigakipackage # NeverTested; 1; Test-UseAllModules-0.17/t/MANIFESTed/0000755000175000017500000000000012431063744017224 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/MANIFESTed/lib/0000755000175000017500000000000012431063744017772 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/MANIFESTed/lib/TestUseAllModulesTest.pm0000644000175000017500000000004712360265430024544 0ustar ishigakiishigakipackage # TestUseAllModulesTest; 1; Test-UseAllModules-0.17/t/MANIFESTed/lib/TestUseAllModulesTestFoo.pm0000644000175000017500000000005212360265430025204 0ustar ishigakiishigakipackage # TestUseAllModulesTestFoo; 1; Test-UseAllModules-0.17/t/MANIFESTed/t/0000755000175000017500000000000012431063744017467 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/MANIFESTed/t/lib/0000755000175000017500000000000012431063744020235 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/MANIFESTed/t/lib/TestUseAllModulesTestTest.pm0000644000175000017500000000005312360265430025644 0ustar ishigakiishigakipackage # TestUseAllModulesTestTest; 1; Test-UseAllModules-0.17/t/MANIFESTed/MANIFEST0000644000175000017500000000020012360265430020342 0ustar ishigakiishigakilib/TestUseAllModulesTest.pm lib/TestUseAllModulesTestFoo.pm t/lib/TestUseAllModulesTestTest.pm under/TestUseAllModulesUnder.pm Test-UseAllModules-0.17/t/MANIFESTed/under/0000755000175000017500000000000012431063744020341 5ustar ishigakiishigakiTest-UseAllModules-0.17/t/MANIFESTed/under/TestUseAllModulesUnder.pm0000644000175000017500000000005412360265430025247 0ustar ishigakiishigakipackage # TestUseAllModulesTestUnder; 1; Test-UseAllModules-0.17/t/99_podcoverage.t0000644000175000017500000000035612360265430020512 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.17/t/02_no_pm.t0000644000175000017500000000025412360265430017301 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.17/t/05_except.t0000644000175000017500000000051112360265430017460 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.17/META.json0000644000175000017500000000215512431063744016666 0ustar ishigakiishigaki{ "abstract" : "do use_ok() for all the MANIFESTed modules", "author" : [ "Kenichi Ishigaki " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060", "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", "resources" : { "repository" : { "url" : "https://github.com/charsbar/test-useallmodules" } }, "version" : "0.17" } Test-UseAllModules-0.17/Changes0000644000175000017500000000330212431063667016537 0ustar ishigakiishigakiRevision history for Perl extension Test::UseAllModules. 0.17 2014/11/13 - oops, forgot to update MANIFEST... 0.16 2014/11/13 - dropped cpanfile support, as it forced users of this module to update too many modules, especially while testing backward compatibility with older perls. 0.15 2014/07/13 - dropped (experimental) Test::More 1.5/2.0 support 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.17/Makefile.PL0000644000175000017500000000135512431062530017210 0ustar ishigakiishigakiuse strict; use warnings; use ExtUtils::MakeMaker; my %params = ( NAME => 'Test::UseAllModules', VERSION_FROM => 'lib/Test/UseAllModules.pm', ABSTRACT_FROM => 'lib/Test/UseAllModules.pm', AUTHOR => 'Kenichi Ishigaki ', LICENSE => 'perl', PREREQ_PM => { 'Exporter' => 0, 'ExtUtils::Manifest' => 0, 'Test::More' => '0.60', 'Test::Builder' => '0.30', }, META_MERGE => { resources => { repository => 'https://github.com/charsbar/test-useallmodules', }, }, ); my $eumm = eval $ExtUtils::MakeMaker::VERSION; delete $params{LICENSE} if $eumm < 6.31; delete $params{META_MERGE} if $eumm < 6.46; WriteMakefile(%params); Test-UseAllModules-0.17/META.yml0000644000175000017500000000122712431063744016515 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.98, CPAN::Meta::Converter version 2.142060' 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' resources: repository: https://github.com/charsbar/test-useallmodules version: '0.17' Test-UseAllModules-0.17/MANIFEST0000644000175000017500000000121712431063744016374 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)