Test-Distribution-2.00/0000755000175000017500000000000010716504265014653 5ustar shahsagshahsagTest-Distribution-2.00/lib/0000755000175000017500000000000010716504265015421 5ustar shahsagshahsagTest-Distribution-2.00/lib/Test/0000755000175000017500000000000010716504265016340 5ustar shahsagshahsagTest-Distribution-2.00/lib/Test/Distribution.pm0000444000175000017500000003747410716504265021372 0ustar shahsagshahsagpackage Test::Distribution; # pragmata use strict; use vars qw($VERSION @default_types @supported_types); use warnings; # perl modules use ExtUtils::Manifest qw(manicheck); use Test::More; $VERSION = '2.00'; @default_types = qw/manifest use versions prereq pod description podcover/; @supported_types = qw/manifest use versions prereq pod description podcover sig/; my @error; for (qw/File::Spec File::Basename File::Find::Rule/) { eval "require $_"; push @error => $_ if $@; } if (@error) { # construct a nice message with proper placement of commas and # the verb 'to be' in the enumeration of the error(s) @error = sort @error; my $is = @error == 1 ? 'is' : 'are'; my $last = pop @error; my $msg = join ', ' => @error; $msg .= ' and ' if length $msg; $msg .= "$last $is required for Test::Distribution"; plan skip_all => $msg; exit; } # This runs during BEGIN sub import { return if our $been_here++; my $pkg = shift; my %args = @_; use vars qw(@default_types); $args{only} ||= \@default_types; $args{only} = [ $args{only} ] unless ref $args{only} eq 'ARRAY'; $args{not} ||= []; $args{not} = [ $args{not} ] unless ref $args{not} eq 'ARRAY'; $args{tests} ||= 0; $args{dirlist} = [ qw(blib lib) ]; $args{dir} ||= File::Spec->catfile(@{ $args{dirlist} }); $args{podcoveropts} ||= {}; run_tests(\%args); } # This runs after CHECK, i.e. at run-time sub run_tests { my $args = shift; my %args = %$args; our @files = -d $args{dir} ? File::Find::Rule->file()->name('*.pm')->in($args{dir}) : (); our @packages = map { # $_ is like 'blib/lib/Foo/Bar/Baz.pm', # after splitpath: $dir is 'blib/lib/Foo/Bar', $file is 'Baz.pm', # after splitdir: @dir is qw(blib lib Foo Bar), # after shifting off @{$args{dirlist}}, @dir is qw(Foo Bar), # so now we can portably construct the package name. my ($vol, $dir, $file) = File::Spec->splitpath($_); my @dir = grep { length } File::Spec->splitdir($dir); shift @dir for @{ $args{dirlist} }; join '::' => @dir, File::Basename::basename($file, '.pm'); } @files; my %perform; %perform = map { $_ => 1 } @{$args{only}}; delete @perform{ @{$args{not}} }; # need to use() modules before we can check their $VERSIONS, # so we might as well test with use_ok(). $perform{use} = 1 if $perform{versions}; our %testers; our $tests = $args{tests}; for my $type (keys %perform) { die "no such test type: $type\n" unless grep /^$type$/ => our @supported_types; my $pkg = __PACKAGE__ . '::' . $type; $testers{$type} = $pkg->new( packages => \@packages, files => \@files, %args, ); $tests += $testers{$type}->num_tests; } plan tests => $tests; for my $type (@supported_types) { $testers{$type}->run_tests($args) if $perform{$type}; } } sub packages { our @packages } sub files { our @files } sub num_tests { our $tests } package Test::Distribution::base; sub new { my ($class, %args) = @_; bless \%args, $class; } sub num_tests { 0 } sub run_tests {} package Test::Distribution::pod; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { scalar @{ $_[0]->{files} } } sub run_tests { SKIP: { my $self = shift; eval { require Test::Pod; Test::Pod->import; }; skip 'Test::Pod required for testing POD', $self->num_tests() if $@; for my $file (@{ $self->{files} }) { pod_file_ok($file) } } } package Test::Distribution::podcover; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { scalar @{ $_[0]->{packages} } } sub run_tests { SKIP: { my $self = shift; my $args = shift; eval { require Test::Pod::Coverage; Test::Pod::Coverage->import; }; skip 'Test::Pod::Coverage required for testing POD', $self->num_tests() if $@; my $trustme = $args->{podcoveropts}; for my $package (@{ $self->{packages} }) { pod_coverage_ok($package, $trustme, 'Pod Coverage ok') } } } package Test::Distribution::use; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { scalar @{ $_[0]->{packages} } } sub run_tests { my $self = shift; for my $package (@{ $self->{packages} }) { use_ok($package) } } package Test::Distribution::versions; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { my $self = shift; my $num_packages = scalar @{ $self->{packages} }; if($self->{distversion}) { return $num_packages * 2 - 1; # Don't test package itself to see if its own dist version matches } else { return $num_packages; } } sub run_tests { my $self = shift; for my $package (@{ $self->{packages} }) { our $version; my $this_version = do { no strict 'refs'; ${"$package\::VERSION"} }; unless (defined $version) { $version = $this_version; ok(defined($version), "$package defines a version"); next; } ok(defined($version), "$package defines a version"); if($self->{distversion}) { is($this_version, $version, "$package version matches"); } } } package Test::Distribution::description; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { 4 } sub run_tests { my $self = shift; ok(-e, "$_ exists") for qw/MANIFEST README/; ok(-e 'Changes' || -e 'ChangeLog' || -e 'Changes.pod' || -e 'ChangeLog.pod', 'Changes(.pod)? or ChangeLog(.pod)? exists'); ok(-e 'Build.PL' || -e 'Makefile.PL', 'Build.PL or Makefile.PL exists'); } package Test::Distribution::manifest; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { 1 } sub run_tests { my $self = shift; my @missing_files = ExtUtils::Manifest::manicheck(); ok(scalar @missing_files == 0, "Checking MANIFEST integrity"); } package Test::Distribution::prereq; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { 1 } sub run_tests { SKIP: { my $self = shift; eval { require File::Find::Rule; require Module::CoreList; }; skip 'Module::Build PREREQ_PM not yet implemented', $self->num_tests() if -f 'Build.PL'; skip 'File::Find::Rule and Module::CoreList required for testing PREREQ_PM', $self->num_tests() if $@; skip "testing PREREQ_PM not implemented for perl $] because Module::CoreList doesn't know about it", $self->num_tests unless exists $Module::CoreList::version{ $] }; my (%use, %package); File::Find::Rule->file()->nonempty()->or( File::Find::Rule->name(qr/\.p(l|m|od)$/), File::Find::Rule->exec(sub { my $fh; return 0 unless open $fh, $_; my $shebang = <$fh>; close $fh; return $shebang =~ /^#!.*\bperl/; }), )->exec(sub { my $fh; return 0 unless open $fh, $_; while (<$fh>) { $use{$1}++ if /^use \s+ ([^\W\d][\w:]+) (\s*\n | .*;)/x; $package{$1}++ if /^package \s+ ([\w:]+) \s* ;/x; } return 1; })->in($self->{dir}); # We're not interested in use()d modules that are provided by # this distro, or in core modules. It's ok core modules aren't # mentioned in PREREQ_PM. no warnings 'once'; delete @use{ keys %package, keys %{ $Module::CoreList::version{$]} } }; open my $fh, 'Makefile.PL' or die "can't open Makefile.PL: $!\n"; my $make = do { local $/; <$fh> }; close $fh or die "can't close Makefile.PL: $!\n"; $make =~ s/use \s+ ExtUtils::MakeMaker \s* ;/no strict;/gx; $make .= 'sub WriteMakefile { my %h = @_; our @prereq = keys %{ $h{PREREQ_PM} || {} } }'; eval $make; die $@ if $@; delete @use{our @prereq}; ok(keys(%use) == 0, 'All non-core use()d modules listed in PREREQ_PM') or diag(prereq_error(%use)); } } # construct an error message for test output sub prereq_error { my %use = @_; my @modules = sort keys %use; (@modules > 1 ? 'These modules are' : 'A module is') . " used but not mentioned in Makefile.PL's PREREQ_PM:\n" . join "\n" => map { " $_" } @modules; } # XXX - not yet implemented and no docs or tests yet. package Test::Distribution::exports; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { 0 } sub run_tests { my $self = shift; } package Test::Distribution::sig; use Test::More; our @ISA = 'Test::Distribution::base'; sub num_tests { return (-f 'SIGNATURE') ? 1 : 0; } sub run_tests { SKIP: { my $self = shift; return unless $self->num_tests(); eval { require Module::Signature; Module::Signature->import; }; if($@) { skip 'Module::Signature required for this test', $self->num_tests(); } else { my $ret = Module::Signature::verify(); skip "Module::Signature cannot verify", 1 if $ret eq Module::Signature::CANNOT_VERIFY(); cmp_ok $ret, '==', Module::Signature::SIGNATURE_OK(), "Valid signature"; } } } 1; __END__ =head1 NAME Test::Distribution - perform tests on all modules of a distribution =head1 SYNOPSIS $ cat t/01distribution.t use Test::More; BEGIN { eval { require Test::Distribution; }; if($@) { plan skip_all => 'Test::Distribution not installed'; } else { import Test::Distribution; } } $ make test ... =head1 DESCRIPTION When using this module in a test script, it goes through all the modules in your distribution, checks their POD, checks that they compile ok and checks that they all define a $VERSION. This module also performs a numer of test on the distribution itself. It checks that your files match your SIGNATURE file if you have one. It checks that your distribution isn't missing certain 'core' description files. It checks to see you havent' missed out listing any pre-requisites in Makefile.PL. It defines its own testing plan, so you usually don't use it in conjunction with other C modules in the same file. It's recommended that you just create a one-line test script as shown in the SYNOPSIS above. However, there are options... B If you do not specify any options Test::Distribution will run all test types B signature testing which must always be explicitly switched on. In the future I may change the default to run no tests at all as this sounds safer. Mail me if you disagree. =head1 OPTIONS On the line in which you C this module, you can specify named arguments that influence the testing behavior. =over 4 =item C NUMBER> Specifies that in addition to the tests run by this module, your test script will run additional tests. In other words, this value influences the test plan. For example: use Test::Distribution tests => 1; use Test::More; is($foo, $bar, 'baz'); It is important that you don't specify a C argument when using C or other test modules as the plan is handled by C. DEPRECATED FEATURE. I plan to remove this in the future unless I'm contacted by someone that says they find this useful. =item C STRING|LIST> Specifies that only certain sets of tests are to be run. Possible values are those mentioned in TEST TYPES below. For example, if you only want to run the POD tests, you could say: use Test::Distribution only => 'pod'; To specify that you only want to run the POD tests and the C tests, and also that you are going to run two tests of your own, use: use Test::Distribution only => [ qw/pod use/ ], tests => 2; Note that when you specify the C option, the C option is automatically added. This is because in order to get a module's C<$VERSION>, it has to be loaded. In this case we might as well run a C test. The value for C can be a string or a reference to a list of strings. =item C STRING|LIST> Specifies that certain types of tests should not be run. All tests not mentioned in this argument are run. For example, if you want to test everything except the POD, use: use Test::Distribution not => 'pod'; The value for C can be a string or a reference to a list of strings. Although it doesn't seem to make much sense, you can use both C and C. In this case only the tests specified in C, but not C are run (if this makes any sense). =item C If you test this to a true value, as well as testing that each module has a $VERSION defined, Test::Distribution will also ensure that the $VERSION matches that of the distribution. =item C You can set this to be a hash reference of options to pass to Test::Pod::Coverage's pod_coverage_ok method (which in turn gets passed to Pod::Coverage. =back =head1 TEST TYPES Here is a description of the types of tests available. =over 4 =item C Checks that the following files exist: =over 4 =item Changes or ChangeLog =item MANIFEST =item README =item Build.PL or Makefile.PL =back =item C Checks whether all Cd modules that aren't in the perl core are also mentioned in Makefile.PL's C. =item C Checks for POD errors in files =item C Checks for Pod Coverage =item C If the distribution has a SIGNATURE file, checks the SIGNATURE matches the files. =item C This Cs the modules to make sure the load happens ok. =item C Checks that all packages define C<$VERSION> strings. =back =head1 EXPOSED INTERNALS There are a few subroutines to help you see what this module is doing. Note that these subroutines are neither exported nor exportable, so you have to call them fully qualified. =over 4 =item C This is a list of packages that have been found. That is, we assume that each file contains a package of the name indicated by the file's relative position. For example, a file in C is expected to be available via C. =item C This is a list of files that tests have been run on. The filenames are relative to the distribution's root directory, so they start with C. =item C This is the number of tests that this module has run, based on your specifications. =back =head1 INSTALLATION This module uses Module::Build for its installation. To install this module type the following: perl Build.PL ./Build ./Build test ./Build install If you do not have Module::Build type: perl Makefile.PL to fetch it. Or use CPAN or CPANPLUS and fetch it "manually". =head1 DEPENDENCIES This module requires these other modules and libraries: File::Basename File::Find::Rule File::Spec Test::More This module has these optional dependencies: Module::CoreList Test::Pod Test::Pod::Coverage If C is missing, the C tests are skipped. If C is missing, the C tests are skipped. =head1 TODO Just because these items are in the todo list, does not mean they will actually be done. If you think one of these would be helpful say so - and it will then move up on my priority list. =over 4 =item * Module::Build support [currently waiting for a fix on Test::Prereq ] =back =head1 FEATURE IDEAS =over 4 =item C test type This would mandate that there should be a test for each exported symbol of each module. =back Let me know what you think of these ideas. Are they necessary? Unnecessary? Do you have feature requests of your own? =head1 BUGS To report a bug or request an enhancement use CPAN's excellent Request Tracker. =head1 SOURCE AVAILABILITY This source is part of a SourceForge project which always has the latest sources in svn. http://sourceforge.net/projects/sagar-r-shah/ =head1 AUTHORS Marcel GrEnauer Sagar R. Shah =head1 OTHER CREDITS This module was inspired by a use.perl.org journal entry by C (see L) where he describes an idea by Andy Lester. =head1 COPYRIGHT & LICENSE Copyright 2002-2003 Marcel GrEnauer. All rights reserved. Copyright 2003-2007, Sagar R. Shah, All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO perl(1), ExtUtils::Manifest(3pm), File::Find::Rule(3pm), Module::CoreList(3pm), Test::More(3pm), Test::Pod(3pm), Test::Pod::Coverage(3pm), Test::Signature(3pm). =cut Test-Distribution-2.00/META.yml0000444000175000017500000000235210716504265016124 0ustar shahsagshahsag--- name: Test-Distribution version: 2.00 author: - 'Marcel GrEnauer ' abstract: perform tests on all modules of a distribution license: perl resources: license: http://dev.perl.org/licenses/ requires: ExtUtils::Manifest: 1.43 File::Find::Rule: 0.03 Module::CoreList: 1.93 Pod::Coverage: 0.17 Test::More: 0.45 Test::Pod: 0.95 Test::Pod::Coverage: 0 provides: Test::Distribution: file: lib/Test/Distribution.pm version: 2.00 Test::Distribution::base: file: lib/Test/Distribution.pm Test::Distribution::description: file: lib/Test/Distribution.pm Test::Distribution::exports: file: lib/Test/Distribution.pm Test::Distribution::manifest: file: lib/Test/Distribution.pm Test::Distribution::pod: file: lib/Test/Distribution.pm Test::Distribution::podcover: file: lib/Test/Distribution.pm Test::Distribution::prereq: file: lib/Test/Distribution.pm Test::Distribution::sig: file: lib/Test/Distribution.pm Test::Distribution::use: file: lib/Test/Distribution.pm Test::Distribution::versions: file: lib/Test/Distribution.pm generated_by: Module::Build version 0.2808 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 Test-Distribution-2.00/Changes.pod0000444000175000017500000001674210716504265016737 0ustar shahsagshahsag=head1 Revision history for Test::Distribution. =head2 2.00 (svn rev 29) =over * =item SIGNATURE support - back but optional. What i should have done in the first place! Sorry guys! =item Fixed Changes.pod layout =back =head2 1.29 (svn rev 19) - REMOVED FROM CPAN =over * =item Removed SIGNATURE support - the sig fad has gone away, there have been issues with checking sigs on non-windows platforms =back =head2 1.28 (svn rev 10) =over * =item Support distribtions such as httpd_ctl which have no blib/lib dir =back =head2 1.27 (svn rev 4) =over * =item Documented source availability on sourceforge =item Changes now in a pod file =back =head2 1.26 =over * =item Stoped using 'our' as this is not supported by Perl pre 5.6.x =item Changes.pod or ChangeLog.pod also allowed. (Thanks to Nik Clayton for the suggestion) =item Search for .pm files in blib/lib not lib =item Build.PL explitly requires a version of Pod::Coverage as Test::Pod::Coverage doesn't and it needs it (at least for the features I'm using). Thanks to Jim Keenan for pointing this out. =back =head2 1.25 =over * =item Removed Makefile.PL - everyone knows what Module::Build is these days =back =head2 1.24 =over * =item Removed message asking users not to log bugs to rt.cpan.org as I do now seem to finally own the bugs queue for this module =back =head2 1.23 =over * =item Stop using the MANIFEST list to find .pm files, just search under lib instead. This prevents T::D from trying to use modules not for install (e.g. under t/lib) and using them incorrectly! Let me know if you'd like more flexiblity (e.g. to override the search directory, and if you need to specify multiple search roots). There is a dir option but it's not public/documented because I think I need to do a thorough code review to make sure it works properly. As I say, let me know if you want/need this flexibility and I shall add it to a future release. =back =head2 1.22 =over * =item .xpm files are no longer matched as modules =back =head2 1.21 =over * =item Try to fix one of the windows build errors that some users see by using Module::Signature directly instead of Test::Signature. Specifically the use of the CANNOT_VERIFY method - as it seems one can have Module::Signature installed without having the software which can actually do the verification installed. =back =head2 1.20 =over * =item Minor documentation updates =back =head2 1.19 =over * =item Added Test::Pod::Coverage support =back =head2 1.18 =over * =item Now accept file ChangeLog as an alternative to Changes =item Minor bug fix Thanks to Steffen Schwigon for both of these changes. =back =head2 1.17 =over * =item Added the distversion option so that people can check whether $VERSION matches the distribution version. This used to be a mandatory check but was removed in 1.14. =back =head2 1.16 =over * =item Minimum version of ExtUtils::Manifest required is 1.43. Passthrough Makefile.PL is now generated by Module::Build and so is up to date and now explicitly sets the build_class. Thanks to Gabor Szabo for reporting these bugs in Test-Distribution v1.15 =back =head2 1.15 =over * =item Test::Distribution now uses the MANIFEST to find modules to test. It falls back to doing a find for *.pm if no MANIFEST exists. (thanks to Paul Hughes aka Barbie and Steffen Müller for suggesting this) =item Added manifest test. thanks to patch from Jonas B.Nielsen =back =head2 1.14 =over * =item Versions test now less restrictive. It only requires each package defined a version. The version does not need to be the same as the distribution version. It just needs to exist This caters for the quite valid style of using cvs versions in individual files. Perl does not requrie all files in a dist to have the same $VERSION. However if you think that checking against the dist version would be a useful check for your personal style, let me know and i'll add that check back in as an optional switch. (thanks to Paul Hughes aka Barbie for the spot) =back =head2 1.13 =over * =item Simple update of TODO which i should have done in 1.12 =back =head2 1.12 =over * =item prereq tests are now skipped if a Build.PL is found. Stop gap measure till Test::Prereq has been patched. (thanks to Paul Hughes aka Barbie) =back =head2 1.11 =over * =item Removed Test::Prereq as a prerequisite as i'm not actually using it yet =item 02extra.t is more friendly on non-Unix style platforms Thanks to Paul Hughes aka Barbie =back =head2 1.10 =over * =item Updated TODO =back =head2 1.09 =over * =item Added missing Test::Signature to requires hash in Build.PL =item Added missing SKIP block to Test::Distribution::sig::run_tests =back =head2 1.08 =over * =item Updated example of 01distribution.t with code that doesn't cause testing of the module to fail if user does not have Test::Distribtion installed. This is good because it means module authors who do not want to force their users to install Test::Distribution and all of its dependencies do not have to =item Added support for sig testing via Test::Signature =back =head2 1.07 =over * =item Minor POD Updates =item Description tests now allow no Makefile.PL if you have a Build.PL. However this does not mean Module::Build support. You still need a Makefile.PL to prevent the PREREQ_PM tests failing. Module::Build support will hopefully follow in a future version. =back =head2 1.06 =over * =item New Maintainer/Owner: Sagar R. Shah =item Moved from ExtUtils::MakeMaker to Module::Build for building =item Tests are now run in a specific order (stops Test::Distribution trying to evaluate $VERSION before doing a use) =item All non-core use()d modules test now has a proper test name =item Thanks to David A Golden for the patch =back =head2 1.05 =over * =item Testing PREREQ_PM relies on Module::CoreList which, even at the current version, doesn't know about perl 5.8.1 yet. So in the meantime, I've added a simple check to skip PREREQ_PM testing if $Module::CoreList::version{ $] } doesn't exist (thanks Randal L. Schwartz and Richard Clamp). =item Testing PREREQ_PM now outputs an easy-to-understand error message if necessary. Previously I just used Test::More's is(), which didn't say what the test was about, just that two strings didn't match. =back =head2 1.04 =over * =item Changed to use Test::Pod 0.95 and pod_file_ok function instead of pod_ok to prevent deprecation warnings (thanks Sagar Shah) =back =head2 1.03 =over * - =item added a named argument 'not' to ask not to do certain types of tests =item added test type 'prereq' that checks whether all non-provided non-core use()d files are in Makefile.PL's PREREQ_PM =item added test type 'description' that checks whether Changes, README, MANIFEST and Makefile.PL exist =item added checking for required modules with eval{} so we can skip tests if necessary (thanks petdance) =item changed munging of file and directory names from regexes to use File::Spec, to be portable =back =head2 1.02 =over * =item changed the name to Test::Distribution as per Andy Lester's suggestion and updated docs. =back =head2 1.01 =over * =item added named arguments ('tests', 'only') and reflection subs (packages(), files(), num_tests()), and docs for the same. =back =head2 1.00 =over * =item ideas by Andy Lester and brian d foy (see http://use.perl.org/~brian_d_foy/journal/7463) =item original version; created by h2xs 1.22 with options =item XAn Test::Comprehensive =back Test-Distribution-2.00/README0000444000175000017500000001755110716504265015542 0ustar shahsagshahsagNAME Test::Distribution - perform tests on all modules of a distribution SYNOPSIS $ cat t/01distribution.t use Test::More; BEGIN { eval { require Test::Distribution; }; if($@) { plan skip_all => 'Test::Distribution not installed'; } else { import Test::Distribution; } } $ make test ... DESCRIPTION When using this module in a test script, it goes through all the modules in your distribution, checks their POD, checks that they compile ok and checks that they all define a $VERSION. This module also performs a numer of test on the distribution itself. It checks that your files match your SIGNATURE file if you have one. It checks that your distribution isn't missing certain 'core' description files. It checks to see you havent' missed out listing any pre-requisites in Makefile.PL. It defines its own testing plan, so you usually don't use it in conjunction with other "Test::*" modules in the same file. It's recommended that you just create a one-line test script as shown in the SYNOPSIS above. However, there are options... NOTE If you do not specify any options Test::Distribution will run all test types except signature testing which must always be explicitly switched on. In the future I may change the default to run no tests at all as this sounds safer. Mail me if you disagree. OPTIONS On the line in which you "use()" this module, you can specify named arguments that influence the testing behavior. "tests => NUMBER" Specifies that in addition to the tests run by this module, your test script will run additional tests. In other words, this value influences the test plan. For example: use Test::Distribution tests => 1; use Test::More; is($foo, $bar, 'baz'); It is important that you don't specify a "tests" argument when using "Test::More" or other test modules as the plan is handled by "Test::Distribution". DEPRECATED FEATURE. I plan to remove this in the future unless I'm contacted by someone that says they find this useful. "only => STRING|LIST" Specifies that only certain sets of tests are to be run. Possible values are those mentioned in TEST TYPES below. For example, if you only want to run the POD tests, you could say: use Test::Distribution only => 'pod'; To specify that you only want to run the POD tests and the "use" tests, and also that you are going to run two tests of your own, use: use Test::Distribution only => [ qw/pod use/ ], tests => 2; Note that when you specify the "versions" option, the "use" option is automatically added. This is because in order to get a module's $VERSION, it has to be loaded. In this case we might as well run a "use" test. The value for "only" can be a string or a reference to a list of strings. "not => STRING|LIST" Specifies that certain types of tests should not be run. All tests not mentioned in this argument are run. For example, if you want to test everything except the POD, use: use Test::Distribution not => 'pod'; The value for "not" can be a string or a reference to a list of strings. Although it doesn't seem to make much sense, you can use both "only" and "not". In this case only the tests specified in "only", but not "not" are run (if this makes any sense). "distversion" If you test this to a true value, as well as testing that each module has a $VERSION defined, Test::Distribution will also ensure that the $VERSION matches that of the distribution. "podcoveropts" You can set this to be a hash reference of options to pass to Test::Pod::Coverage's pod_coverage_ok method (which in turn gets passed to Pod::Coverage. TEST TYPES Here is a description of the types of tests available. "description" Checks that the following files exist: Changes or ChangeLog MANIFEST README Build.PL or Makefile.PL "prereq" Checks whether all "use()"d modules that aren't in the perl core are also mentioned in Makefile.PL's "PREREQ_PM". "pod" Checks for POD errors in files "podcover" Checks for Pod Coverage "sig" If the distribution has a SIGNATURE file, checks the SIGNATURE matches the files. "use" This "use()"s the modules to make sure the load happens ok. "versions" Checks that all packages define $VERSION strings. EXPOSED INTERNALS There are a few subroutines to help you see what this module is doing. Note that these subroutines are neither exported nor exportable, so you have to call them fully qualified. "Test::Distribution::packages()" This is a list of packages that have been found. That is, we assume that each file contains a package of the name indicated by the file's relative position. For example, a file in "blib/lib/Foo/Bar.pm" is expected to be available via "use Foo::Bar". "Test::Distribution::files()" This is a list of files that tests have been run on. The filenames are relative to the distribution's root directory, so they start with "blib/lib". "Test::Distribution::num_tests()" This is the number of tests that this module has run, based on your specifications. INSTALLATION This module uses Module::Build for its installation. To install this module type the following: perl Build.PL ./Build ./Build test ./Build install If you do not have Module::Build type: perl Makefile.PL to fetch it. Or use CPAN or CPANPLUS and fetch it "manually". DEPENDENCIES This module requires these other modules and libraries: File::Basename File::Find::Rule File::Spec Test::More This module has these optional dependencies: Module::CoreList Test::Pod Test::Pod::Coverage If "Module::CoreList" is missing, the "prereq" tests are skipped. If "Test::Pod" is missing, the "pod" tests are skipped. TODO Just because these items are in the todo list, does not mean they will actually be done. If you think one of these would be helpful say so - and it will then move up on my priority list. * Module::Build support [currently waiting for a fix on Test::Prereq ] FEATURE IDEAS "export" test type This would mandate that there should be a test for each exported symbol of each module. Let me know what you think of these ideas. Are they necessary? Unnecessary? Do you have feature requests of your own? BUGS To report a bug or request an enhancement use CPAN's excellent Request Tracker. SOURCE AVAILABILITY This source is part of a SourceForge project which always has the latest sources in svn. http://sourceforge.net/projects/sagar-r-shah/ AUTHORS Marcel Grünauer Sagar R. Shah OTHER CREDITS This module was inspired by a use.perl.org journal entry by "brian d foy" (see ) where he describes an idea by Andy Lester. COPYRIGHT & LICENSE Copyright 2002-2003 Marcel Grünauer. All rights reserved. Copyright 2003-2007, Sagar R. Shah, All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO perl(1), ExtUtils::Manifest(3pm), File::Find::Rule(3pm), Module::CoreList(3pm), Test::More(3pm), Test::Pod(3pm), Test::Pod::Coverage(3pm), Test::Signature(3pm). Test-Distribution-2.00/Build.PL0000444000175000017500000000120610716504265016144 0ustar shahsagshahsaguse Module::Build; Module::Build->new( license => 'perl', module_name => 'Test::Distribution', requires => { 'ExtUtils::Manifest' => 1.43, 'File::Find::Rule' => 0.03, 'Module::CoreList' => 1.93, 'Test::More' => 0.45, 'Test::Pod' => 0.95, 'Test::Pod::Coverage'=> 0, 'Pod::Coverage' => 0.17, # Test::Pod::Coverage features that I use need a not very old version of Pod::Coverage. This or 0.15 may be the minimum required. }, create_readme => 1, add_to_cleanup => [ '*.tar.gz', 'Build', '_build' ], )->create_build_script; Test-Distribution-2.00/t/0000755000175000017500000000000010716504265015116 5ustar shahsagshahsagTest-Distribution-2.00/t/05only_pod_use_extra.t0000444000175000017500000000030110716504265021342 0ustar shahsagshahsaguse Test::Distribution tests => 2, only => [ qw/pod use/ ]; use Test::More; ok(1, 'extra test'); # 2 * (1 module) + 2 extra is(Test::Distribution::num_tests(), 4, 'number of tests'); Test-Distribution-2.00/t/06only_pod_versions_extra.t0000444000175000017500000000030610716504265022424 0ustar shahsagshahsaguse Test::Distribution tests => 2, only => [ qw/pod versions/ ]; use Test::More; ok(1, 'extra test'); # 3 * (1 module) + 2 extra is(Test::Distribution::num_tests(), 5, 'number of tests'); Test-Distribution-2.00/t/07prereq.t0000444000175000017500000000023710716504265016750 0ustar shahsagshahsaguse Test::Distribution tests => 1, only => 'prereq'; use Test::More; # 1 prereq + 1 extra is(Test::Distribution::num_tests(), 2, 'number of tests'); Test-Distribution-2.00/t/02extra.t0000444000175000017500000000125410716504265016570 0ustar shahsagshahsaguse Test::Distribution tests => 4, podcoveropts => {trustme => [qr/run_tests/]};; use Test::More; ok(1, 'extra test'); # 4 descriptions + 4 * (1 module) + 4 extra + 1 prereq + 1 manifest my $number_of_tests = 14; is(Test::Distribution::num_tests(), $number_of_tests, 'number of tests'); is_deeply(Test::Distribution::packages(), 'Test::Distribution', 'packages found'); my @files = Test::Distribution::files(); # On non Unix type file systems the first file separator could be different # than the unix /. This is because it comes from File::Spec. The others will # still be a unix / because they come from File::Find::Rule like($files[0], qr/lib.*?Test.*?Distribution.pm/); Test-Distribution-2.00/t/04only_pod_extra.t0000444000175000017500000000027310716504265020475 0ustar shahsagshahsaguse Test::Distribution tests => 2, only => [ 'pod' ]; use Test::More; ok(1, 'extra test'); # 1 * (1 module) + 2 extra is(Test::Distribution::num_tests(), 3, 'number of tests'); Test-Distribution-2.00/t/03only_versions.t0000444000175000017500000000016510716504265020357 0ustar shahsagshahsaguse Test::Distribution only => [ 'versions' ]; # basically just test that importing works, should produce two tests. Test-Distribution-2.00/t/01distribution.t0000444000175000017500000000010510716504265020155 0ustar shahsagshahsaguse Test::Distribution podcoveropts => {trustme => [qr/run_tests/]}; Test-Distribution-2.00/t/08only_podcover.t0000444000175000017500000000027510716504265020337 0ustar shahsagshahsaguse Test::Distribution tests => 1, only => 'podcover', podcoveropts => {trustme => [qr/run_tests/]}; use Test::More; is(Test::Distribution::num_tests(), 2 , 'number of tests'); Test-Distribution-2.00/MANIFEST0000444000175000017500000000037410716504265016006 0ustar shahsagshahsagBuild.PL Changes.pod lib/Test/Distribution.pm MANIFEST This list of files META.yml README t/01distribution.t t/02extra.t t/03only_versions.t t/04only_pod_extra.t t/05only_pod_use_extra.t t/06only_pod_versions_extra.t t/07prereq.t t/08only_podcover.t