build_requires 'Test::Deep' => '0';
build_requires 'Test::Exception' => '0';
build_requires 'Test::TempDir' => '0.02';
+build_requires 'Test::Requires' => '0.05';
author_requires 'Test::Pod' => '1.14';
author_requires 'Test::Pod::Coverage' => '1.08';
my $dir = tempdir;
-BEGIN {
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
+use Test::Requires {
+ 'JSON::Any' => 0.01, # skip all if not installed
+};
+
+BEGIN {
plan tests => 10;
use_ok('MooseX::Storage');
}
use Test::More;
-BEGIN {
- eval "use Test::JSON";
- plan skip_all => "Test::JSON is required for this test" if $@;
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
+use Test::Requires {
+ 'Test::JSON' => 0.01, # skip all if not installed
+ 'JSON::Any' => 0.01,
+};
+
+BEGIN {
plan tests => 12;
use_ok('MooseX::Storage');
}
use Test::More;
+use Test::Requires {
+ 'Encode' => 0.01, # skip all if not installed
+ 'JSON::Any' => 0.01,
+};
+
BEGIN {
- eval "use Encode";
- plan skip_all => "Encode is required for this test" if $@;
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
# NOTE:
# this is because JSON::XS is
# the only one which really gets
# utf8 correct
# - SL
- BEGIN {
+ BEGIN {
$ENV{JSON_ANY_ORDER} = qw(XS);
$ENV{JSON_ANY_CONFIG} = "utf8=1";
- }
+ }
+
plan tests => 16;
use_ok('MooseX::Storage');
}
use Test::More;
-BEGIN {
- local $@;
- plan skip_all => "MooseX::Storage::Format::JSONpm required for this test"
- unless eval "require MooseX::Storage::Format::JSONpm; 1";
-}
+use Test::Requires {
+ 'MooseX::Storage::Format::JSONpm' => 0.01, # skip all if not installed
+};
-plan tests => 6;
-use_ok('MooseX::Storage');
+BEGIN {
+ plan tests => 6;
+ use_ok('MooseX::Storage');
+}
{
package Foo;
use Test::More;
+use Test::Requires {
+ 'YAML::Any' => 0.01, # skip all if not installed
+ 'YAML' => 0.01,
+ 'Test::Without::Module' => 0.01,
+};
+
BEGIN {
- eval "use YAML::Any";
- plan skip_all => "YAML::Any is required for this test" if $@;
- eval "require YAML";
- plan skip_all => "YAML is required for this test" if $@;
- eval "require Test::Without::Module";
- plan skip_all => "Test::Without::Module is required for this test" if $@;
Test::Without::Module->import(YAML::Any->order);
Test::Without::Module->unimport('YAML');
plan tests => 10;
use Test::More;
+use Test::Requires {
+ 'YAML::Any' => 0.01, # skip all if not installed
+ 'YAML::Syck' => 0.01,
+ 'Test::Without::Module' => 0.01,
+};
+
BEGIN {
- eval "use YAML::Any";
- plan skip_all => "YAML::Any is required for this test" if $@;
- eval "require YAML::Syck";
- plan skip_all => "YAML::Syck is required for this test" if $@;
- eval "require Test::Without::Module";
- plan skip_all => "Test::Without::Module is required for this test" if $@;
Test::Without::Module->import(YAML::Any->order);
Test::Without::Module->unimport('YAML::Syck');
plan tests => 10;
}
{
-
package Foo;
use Moose;
use MooseX::Storage;
use Test::More;
+use Test::Requires {
+ 'YAML::Any' => 0.01, # skip all if not installed
+ 'YAML::XS' => 0.01,
+ 'Test::Without::Module' => 0.01,
+};
+
BEGIN {
- eval "use YAML::Any";
- plan skip_all => "YAML::Any is required for this test" if $@;
- eval "require YAML::XS";
- plan skip_all => "YAML::XS is required for this test" if $@;
- eval "require Test::Without::Module";
- plan skip_all => "Test::Without::Module is required for this test" if $@;
Test::Without::Module->import(YAML::Any->order);
Test::Without::Module->unimport('YAML::XS');
plan tests => 10;
}
{
-
package Foo;
use Moose;
use MooseX::Storage;
use Test::Exception;
use Test::Deep;
+use Test::Requires {
+ 'Digest' => 0.01, # skip all if not installed
+ 'Digest::SHA1' => 0.01,
+ 'JSON::Any' => 0.01,
+};
+
BEGIN {
- eval "use Digest; use Digest::SHA1";
- plan skip_all => "Digest and Digest::SHA1 is required for this test" if $@;
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
plan tests => 26;
use_ok('MooseX::Storage');
}
{
-
package Foo;
use Moose;
use MooseX::Storage;
use Test::More;
use Storable;
+use Test::Requires {
+ 'Test::JSON' => 0.01, # skip all if not installed
+ 'JSON::Any' => 0.01,
+ 'YAML::Any' => 0.01,
+};
+
BEGIN {
- eval "use Test::JSON";
- plan skip_all => "Test::JSON is required for this test" if $@;
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
- eval "use YAML::Any";
- plan skip_all => "YAML::Any is required for this test" if $@;
plan tests => 31;
use_ok('MooseX::Storage');
}
diag('Using implementation: ', YAML::Any->implementation);
{
-
package Foo;
use Moose;
use MooseX::Storage;
my $dir = tempdir;
+use Test::Requires {
+ 'IO::AtomicFile' => 0.01, # skip all if not installed
+ 'JSON::Any' => 0.01,
+};
+
BEGIN {
- eval "use IO::AtomicFile";
- plan skip_all => "IO::AtomicFile is required for this test" if $@;
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
plan tests => 20;
use_ok('MooseX::Storage');
}
use File::Spec::Functions;
my $dir = tempdir;
-BEGIN {
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
- plan tests => 10;
+use Test::Requires {
+ 'JSON::Any' => 0.01, # skip all if not installed
+};
+
+BEGIN {
+ plan tests => 10;
use_ok('MooseX::Storage');
}
use File::Spec::Functions;
my $dir = tempdir( CLEANUP => 1 );
+use Test::Requires {
+ 'JSON::Any' => 0.01, # skip all if not installed
+ 'IO::AtomicFile' => 0.01,
+};
+
BEGIN {
- eval "use IO::AtomicFile";
- plan skip_all => "IO::AtomicFile is required for this test" if $@;
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
plan tests => 10;
use_ok('MooseX::Storage');
}
use File::Spec::Functions;
my $dir = tempdir( CLEANUP => 1 );
+use Test::Requires {
+ 'JSON::Any' => 0.01, # skip all if not installed
+ 'IO::AtomicFile' => 0.01,
+};
+
BEGIN {
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
# NOTE:
# this is because JSON::XS is
# the only one which really gets
# utf8 correct
# - SL
- BEGIN {
+ BEGIN {
$ENV{JSON_ANY_ORDER} = qw(XS);
$ENV{JSON_ANY_CONFIG} = "utf8=1";
- }
+ }
plan tests => 8;
use_ok('MooseX::Storage');
}
use File::Spec::Functions;
my $dir = tempdir;
+use Test::Requires {
+ 'JSON::Any' => 0.01, # skip all if not installed
+ 'IO::AtomicFile' => 0.01,
+};
+
BEGIN {
- eval "use IO::AtomicFile";
- plan skip_all => "IO::AtomicFile is required for this test" if $@;
- eval "use JSON::Any";
- plan skip_all => "JSON::Any is required for this test" if $@;
# NOTE:
# this is because JSON::XS is
# the only one which really gets
# utf8 correct
# - SL
- BEGIN {
+ BEGIN {
$ENV{JSON_ANY_ORDER} = qw(XS);
$ENV{JSON_ANY_CONFIG} = "utf8=1";
- }
+ }
plan tests => 8;
use_ok('MooseX::Storage');
}
use Test::More;
use Test::Exception;
-BEGIN {
- eval { require JSON::Any } or do {
- plan skip_all => "JSON::Any is required for this test";
- exit 0;
- }
-}
+use Test::Requires {
+ 'JSON::Any' => 0.01, # skip all if not installed
+};
{
package Thing;