|
Packit |
912535 |
NAME
|
|
Packit |
912535 |
Test::Needs - Skip tests when modules not available
|
|
Packit |
912535 |
|
|
Packit |
912535 |
SYNOPSIS
|
|
Packit |
912535 |
# need one module
|
|
Packit |
912535 |
use Test::Needs 'Some::Module';
|
|
Packit |
912535 |
|
|
Packit |
912535 |
# need multiple modules
|
|
Packit |
912535 |
use Test::Needs 'Some::Module', 'Some::Other::Module';
|
|
Packit |
912535 |
|
|
Packit |
912535 |
# need a given version of a module
|
|
Packit |
912535 |
use Test::Needs {
|
|
Packit |
912535 |
'Some::Module' => '1.005',
|
|
Packit |
912535 |
};
|
|
Packit |
912535 |
|
|
Packit |
912535 |
# check later
|
|
Packit |
912535 |
use Test::Needs;
|
|
Packit |
912535 |
test_needs 'Some::Module';
|
|
Packit |
912535 |
|
|
Packit |
912535 |
# skips remainder of subtest
|
|
Packit |
912535 |
use Test::More;
|
|
Packit |
912535 |
use Test::Needs;
|
|
Packit |
912535 |
subtest 'my subtest' => sub {
|
|
Packit |
912535 |
test_needs 'Some::Module';
|
|
Packit |
912535 |
...
|
|
Packit |
912535 |
};
|
|
Packit |
912535 |
|
|
Packit |
912535 |
# check perl version
|
|
Packit |
912535 |
use Test::Needs { perl => 5.020 };
|
|
Packit |
912535 |
|
|
Packit |
912535 |
DESCRIPTION
|
|
Packit |
912535 |
Skip test scripts if modules are not available. The requested modules
|
|
Packit |
912535 |
will be loaded, and optionally have their versions checked. If the
|
|
Packit |
912535 |
module is missing, the test script will be skipped. Modules that are
|
|
Packit |
912535 |
found but fail to compile will exit with an error rather than skip.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
If used in a subtest, the remainder of the subtest will be skipped.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
Skipping will work even if some tests have already been run, or if a
|
|
Packit |
912535 |
plan has been declared.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
Versions are checked via a "$module->VERSION($wanted_version)" call.
|
|
Packit |
912535 |
Versions must be provided in a format that will be accepted. No extra
|
|
Packit |
912535 |
processing is done on them.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
If "perl" is used as a module, the version is checked against the
|
|
Packit |
912535 |
running perl version ($]). The version can be specified as a number,
|
|
Packit |
912535 |
dotted-decimal string, v-string, or version object.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
If the "RELEASE_TESTING" environment variable is set, the tests will
|
|
Packit |
912535 |
fail rather than skip. Subtests will be aborted, but the test script
|
|
Packit |
912535 |
will continue running after that point.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
EXPORTS
|
|
Packit |
912535 |
test_needs
|
|
Packit |
912535 |
Has the same interface as when using Test::Needs in a "use".
|
|
Packit |
912535 |
|
|
Packit |
912535 |
SEE ALSO
|
|
Packit |
912535 |
Test::Requires
|
|
Packit |
912535 |
A similar module, with some important differences. Test::Requires
|
|
Packit |
912535 |
will act as a "use" statement (despite its name), calling the import
|
|
Packit |
912535 |
sub. Under "RELEASE_TESTING", it will BAIL_OUT if a module fails to
|
|
Packit |
912535 |
load rather than using a normal test fail. It also doesn't
|
|
Packit |
912535 |
distinguish between missing modules and broken modules.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
Test2::Require::Module
|
|
Packit |
912535 |
Part of the Test2 ecosystem. Only supports running as a "use"
|
|
Packit |
912535 |
command to skip an entire plan.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
AUTHOR
|
|
Packit |
912535 |
haarg - Graham Knop (cpan:HAARG) <haarg@haarg.org>
|
|
Packit |
912535 |
|
|
Packit |
912535 |
CONTRIBUTORS
|
|
Packit |
912535 |
None so far.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
COPYRIGHT
|
|
Packit |
912535 |
Copyright (c) 2016 the Test::Needs "AUTHOR" and "CONTRIBUTORS" as listed
|
|
Packit |
912535 |
above.
|
|
Packit |
912535 |
|
|
Packit |
912535 |
LICENSE
|
|
Packit |
912535 |
This library is free software and may be distributed under the same
|
|
Packit |
912535 |
terms as perl itself. See <http://dev.perl.org/licenses/>.
|
|
Packit |
912535 |
|