test_requires 'Test::More' => '0.88';
test_requires 'Test::Exception' => '0.27';
+test_requires 'Test::Requires' => '0.05';
author_requires 'File::Find::Rule';
author_requires 'Module::Info';
use warnings;
use Test::More;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
-}
+use Test::Requires {
+ 'Test::Output' => '0.01', # skip all if not installed
+};
{
package Foo;
use warnings;
use Test::More;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
-}
+
+use Test::Requires {
+ 'Test::Output' => '0.01', # skip all if not installed
+};
{
package Foo;
use strict;
use warnings;
use Test::More;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
-}
+
+use Test::Requires {
+ 'Test::Output' => '0.01', # skip all if not installed
+};
# this test script ensures that my idiom of:
# role: sub BUILD, after BUILD
use Test::More;
use Test::Exception;
-BEGIN {
- eval "use IO::String; use IO::File;";
- plan skip_all => "IO::String and IO::File are required for this test" if $@;
-}
-
+use Test::Requires {
+ 'IO::String' => '0.01', # skip all if not installed
+ 'IO::File' => '0.01',
+};
{
package Email::Moose;
use Test::More;
use Test::Exception;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
-}
+use Test::Requires {
+ 'Test::Output' => '0.01', # skip all if not installed
+};
{
package HasOwnImmutable;
use File::Spec;
use File::Temp 'tempdir';
-BEGIN {
- eval "use Module::Refresh;";
- plan skip_all => "Module::Refresh is required for this test" if $@;
-}
+use Test::Requires {
+ 'Module::Refresh' => '0.01', # skip all if not installed
+};
=pod
use Test::More;
-BEGIN {
- eval "use DBM::Deep 1.0003;";
- plan skip_all => "DBM::Deep 1.0003 (or greater) is required for this test" if $@;
- eval "use DateTime::Format::MySQL;";
- plan skip_all => "DateTime::Format::MySQL is required for this test" if $@;
-}
+use Test::Requires {
+ 'DBM::Deep' => '1.0003', # skip all if not installed
+ 'DateTime::Format::MySQL' => '0.01',
+};
use Test::Exception;
=cut
-BEGIN {
- eval "use Declare::Constraints::Simple;";
- plan skip_all => "Declare::Constraints::Simple is required for this test" if $@;
-}
+use Test::Requires {
+ 'Declare::Constraints::Simple' => '0.01', # skip all if not installed
+};
use Test::Exception;
=cut
-BEGIN {
- eval "use Test::Deep;";
- plan skip_all => "Test::Deep is required for this test" if $@;
-}
+use Test::Requires {
+ 'Test::Deep' => '0.01', # skip all if not installed
+};
use Test::Exception;
use warnings;
use Test::More;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
-}
+
+use Test::Requires {
+ 'Test::Output' => '0.01', # skip all if not installed
+};
{
package NotMoose;
use warnings;
use Test::More;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
-}
+
+use Test::Requires {
+ 'Test::Output' => '0.01', # skip all if not installed
+};
{
package ModdedNew;
use warnings;
use Test::More;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
-}
+
+use Test::Requires {
+ 'Test::Output' => '0.01', # skip all if not installed
+};
{
package Foo;
use Test::More;
-eval "use Test::Pod 1.14";
-plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+use Test::Requires {
+ 'Test::Pod' => '1.14', # skip all if not installed
+};
all_pod_files_ok();
use Test::More;
-eval "use Test::Pod::Coverage 1.04";
-plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+use Test::Requires {
+ 'Test::Pod::Coverage' => '1.04', # skip all if not installed
+};
# This is a stripped down version of all_pod_coverage_ok which lets us
# vary the trustme parameter per module.
use Test::More;
-eval "use Test::NoTabs 0.8";
-plan skip_all => "Test::NoTabs 0.8 required for testing tabs" if $@;
+use Test::Requires {
+ 'Test::NoTabs' => '0.8', # skip all if not installed
+};
# Module::Install has tabs, so we can't check 'inc' or ideally '.'
all_perl_files_ok('lib', 't', 'xt');
plan skip_all => 'This test will not run unless you set MOOSE_TEST_MD to a true value'
unless $ENV{MOOSE_TEST_MD};
-eval 'use Test::DependentModules qw( test_all_dependents test_module );';
-plan skip_all => 'This test requires Test::DependentModules'
- if $@;
+use Test::Requires {
+ 'Test::DependentModules' => '0.01', # skip all if not installed
+};
+use Test::DependentModules qw( test_all_dependents test_module );
$ENV{PERL_TEST_DM_LOG_DIR} = abs_path('.');