1Test::Requires(3) User Contributed Perl Documentation Test::Requires(3)
2
3
4
6 Test::Requires - Checks to see if the module can be loaded
7
9 # in your Makefile.PL
10 use inc::Module::Install;
11 test_requires 'Test::Requires';
12
13 # in your test
14 use Test::More tests => 10;
15 use Test::Requires {
16 'HTTP::MobileAttribute' => 0.01, # skip all if HTTP::MobileAttribute doesn't installed
17 };
18 isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';
19
20 # or
21 use Test::More tests => 10;
22 use Test::Requires qw(
23 HTTP::MobileAttribute
24 );
25 isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';
26
27 # or
28 use Test::More tests => 10;
29 use Test::Requires;
30 test_requires 'Some::Optional::Test::Required::Modules';
31 isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';
32
34 Test::Requires checks to see if the module can be loaded.
35
36 If this fails rather than failing tests this skips all tests.
37
38 Test::Requires can also be used to require a minimum version of Perl:
39
40 use Test::Requires "5.010"; # quoting is necessary!!
41
42 # or
43 use Test::Requires "v5.10";
44
46 Tokuhiro Matsuno <tokuhirom @*(#RJKLFHFSDLJF gmail.com>
47
49 kazuho++ # some tricky stuff
50 miyagawa++ # original code from t/TestPlagger.pm
51 tomyhero++ # reported issue related older test::builder
52 tobyink++ # documented that Test::Requires "5.010" works
53
55 If the "RELEASE_TESTING" environment variable is true, then instead of
56 skipping tests, Test::Requires bails out.
57
59 "TestPlagger.pm" in t
60
62 This library is free software; you can redistribute it and/or modify it
63 under the same terms as Perl itself.
64
65
66
67perl v5.30.1 2020-01-30 Test::Requires(3)