Test::Requires3pm
Checks to see if the module can be loaded
Usage
# in your Makefile.PLuse inc::Module::Install;test_requires 'Test::Requires';# in your testuse Test::More tests => 10;use Test::Requires {'HTTP::MobileAttribute' => 0.01, # skip all if HTTP::MobileAttribute doesn't installed};isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';# oruse Test::More tests => 10;use Test::Requires qw(HTTP::MobileAttribute);isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';# oruse Test::More tests => 10;use Test::Requires;test_requires 'Some::Optional::Test::Required::Modules';isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';
Overview
Test::Requires checks to see if the module can be loaded.
If this fails rather than failing tests this skips all tests.
Test::Requires can also be used to require a minimum version of Perl:
use Test::Requires "5.010"; # quoting is necessary!!# oruse Test::Requires "v5.10";
Thanks to
kazuho++ # some tricky stuffmiyagawa++ # original code from t/TestPlagger.pmtomyhero++ # reported issue related older test::buildertobyink++ # documented that Test::Requires "5.010" works
Environment
If the "RELEASE_TESTING" environment variable is true, then instead of skipping tests, Test::Requires bails out.
Releases
9 releases since Debian 6.0 (Squeeze); the text changed 5 times.