Test::CompanionClasses - Run tests defined in companion classes


Test-CompanionClasses documentation Contained in the Test-CompanionClasses distribution.

Index


Code Index:

NAME

Top

Test::CompanionClasses - Run tests defined in companion classes

VERSION

Top

version 1.101370

SYNOPSIS

Top

    # Define a test file, for example C<t/01_companion_classes.t>:

    use Test::CompanionClasses;
    run_tests;

    # Then you can do:
    # perl t/01_companion_classes.t --exact Foo::Bar Baz

DESCRIPTION

Top

This is a very basic frontend for Test::CompanionClasses::Engine which you can use for your distribution test files (in t/).

The intention is that you use it as shown in the SYNOPSIS.

METHODS

Top

run_tests

Parses the command-line options, then calls the run_tests() method of Test::CompanionClasses::Engine.

You might want to make sure that the companion tests work when run individually as well. In that case you might use something like this:

    find lib/ -name \*_TEST.pm | \
        xargs ack -ho '(?<=^package )([\w:]+)(?=_TEST)' | \
        xargs -i{} perl t/01_companion_classes.t --exact {}

COMMAND-LINE USAGE

Top

The following command-line arguments are supported:

--exact

Specifies that the package filter is to be used exactly, i.e., substring matching is not enough. See Test::CompanionClasses::Engine for details.

The rest of the command line is interpreted as a list of package filters. Again, see Test::CompanionClasses::Engine for details.

The inherited mechanism is not supported (yet).

INSTALLATION

Top

See perlmodinstall for information and options on installing Perl modules.

BUGS AND LIMITATIONS

Top

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CompanionClasses.

AVAILABILITY

Top

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Test-CompanionClasses/.

The development version lives at http://github.com/hanekomu/Test-CompanionClasses/. Instead of sending patches, please fork this project using the standard git and github infrastructure.

AUTHOR

Top

  Marcel Gruenauer <marcel@cpan.org>

COPYRIGHT AND LICENSE

Top


Test-CompanionClasses documentation Contained in the Test-CompanionClasses distribution.

use 5.008;
use strict;
use warnings;

package Test::CompanionClasses;
BEGIN {
  $Test::CompanionClasses::VERSION = '1.101370';
}
# ABSTRACT: Run tests defined in companion classes
use Test::CompanionClasses::Engine;
use Getopt::Long;
use Exporter qw(import);
our @EXPORT  = ('run_tests');

sub run_tests {
    my $exact;
    GetOptions(exact => \$exact)
      or die "usage: $0 [ --exact ] filter...\n";
    Test::CompanionClasses::Engine->new->run_tests(
        exact  => $exact,
        filter => [@main::ARGV],

        # inherited => [ $inherited_spec ],
    );
}
1;


__END__