NAME

P5U::Lib::Reprove - download a distribution's tests and prove them

SYNOPSIS

my $test = P5U::Lib::Reprove::->new(
    author  => 'TOBYINK',
    release => 'Object-AUTHORITY',
    version => '0.003',
    verbose => 1,
);
$test->run;

DESCRIPTION

This module downloads a distribution's test files (the contents of the t directory) and runs App::Prove (part of Test::Harness) on them.

It assumes that all the other files necessary for passing the test suite are already available on your system, installed into locations where the test suite will be able to find them. In particular, the libraries necessary to pass the test suite must be installed.

It makes a number of assumptions about how a distribution's test cases are structured, but these assumptions do tend to hold in most cases.

This work was previously released as Module::Reprove, but has now been refactored and integrated with P5U.

Constructor

new(%attributes)

Construct an object with given attributes. This is a Moo-based class.

Attributes

release

Release name, e.g. "Moose" or "RDF-Trine". Required.

version

Release version, e.g. "2.0001" or "0.136". Required.

author

Release author's CPAN ID, e.g. "DOY" or "GWILLIAMS". If this is not provided, it can usually be figured out using the MetaCPAN API, but it's a good idea to provide it.

verbose

Boolean indicating whether output should be verbose. Optional, defaults to false.

working_dir

A Path::Tiny object pointing to a directory where all the working will be done. If you don't provide one to the constructor, P5U::Lib::Reprove is sensible enough to create a temporary directory for working in (and delete it afterwards).

manifest

An arrayref of strings, listing all the files in the distribution. Don't provide this to the constructor - just allow P5U::Lib::Reprove to build it.

testdir

A Path::Tiny object pointing to a directory where test cases are stored. Don't provide this to the constructor - just allow P5U::Lib::Reprove to build it.

There is also a pseudo-attribute module which may be provided to the constructor, and allows the automatic calculation of release, version and author. There is no getter/setter method for module though; it is not a true attribute.

Methods

test_files

Returns a list of test case files, based on the contents of the manifest.

run

Runs the test using App::Prove::run and returns whatever App::Prove would have returned, which is undocumented but appears to be false if there are test failures, and true if all tests pass.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=P5U.

SEE ALSO

p5u.

http://www.perlmonks.org/?node_id=942886.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2011-2013 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.