NAME
Test::CompanionClasses::Engine - run tests defined in companion classes
SYNOPSIS
use Test::CompanionClasses;
Test::CompanionClasses->new->run_tests('...');
DESCRIPTION
This is the core of Test::CompanionClasses
.
METHODS
new
-
my $obj = Test::CompanionClasses::Engine->new; my $obj = Test::CompanionClasses::Engine->new(%args);
Creates and returns a new object. The constructor will accept as arguments a list of pairs, from component name to initial value. For each pair, the named component is initialized by calling the method of the same name with the given value. If called with a single hash reference, it is dereferenced and its key/value pairs are set as described before.
run_tests
-
Actually runs the companion class tests.
Takes named arguments (as a hash). Recognized keys are:
filter
-
A reference to a list of strings that are interpreted as package filters. A companion test class is only run if the corresponding real class' package name matches this filter list.
exact
-
Works with
filter
. If this boolean flag is set, the real class name must match exactly, otherwise a substring match is sufficient.Examples:
Test::CompanionClasses->mk_new->run_tests( filter => [ qw/Foo::Bar Baz/ ] );
will run the companion tests of
Foo::Bar
,Baz
but alsoFoo::Bar::Flurble
,Bazzzz
etc.Test::CompanionClasses->mk_new->run_tests( filter => [ qw/Foo::Bar Baz/ ] exact => 1, );
will only run the companion tests of
Foo::Bar
andBaz
. lib
-
Sets the directory in and under which
run_tests()
is looking for test companion classes. Defaults to$Bin/../lib
, where$Bin
is the location of the program as determined by FindBin. This default is used because normally companion class tests will be run from a perl distribution'st/
directory. inherited
-
You can also specify that other classes not found in
lib
should be tested. Use a reference to an array of class names as the value forinherited
and those classes' companion tests will be run as well. The class names still have to match thefilter
, if one was specified.This is useful if your distribution depends on another one which also has defined test companion classes. If your distribution changes the way these other test companion classes are working, you can inherit those tests to see whether they still work with your distribution.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org.
INSTALLATION
See perlmodinstall for information and options on installing Perl modules.
AVAILABILITY
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
Marcel Grünauer, <marcel@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2007-2009 by Marcel Grünauer.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.