From: Karen Etheridge Date: Tue, 24 Aug 2010 20:34:47 +0000 (-0700) Subject: use Test::Requires in tests X-Git-Tag: 1.08~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f3528820cf19ac3bc0896b8659ad969821d317c;p=gitmo%2FClass-MOP.git use Test::Requires in tests --- diff --git a/Makefile.PL b/Makefile.PL index 3d66fb4..8a8db4a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -33,6 +33,7 @@ requires 'Task::Weaken'; test_requires 'File::Spec'; test_requires 'Test::More' => '0.88'; test_requires 'Test::Exception' => '0.27'; +test_requires 'Test::Requires' => '0.05'; repository 'git://git.moose.perl.org/Class-MOP.git'; add_metadata(x_authority => 'cpan:STEVAN'); diff --git a/t/050_scala_style_mixin_composition.t b/t/050_scala_style_mixin_composition.t index 3c46368..b3c5376 100644 --- a/t/050_scala_style_mixin_composition.t +++ b/t/050_scala_style_mixin_composition.t @@ -3,10 +3,9 @@ use warnings; use Test::More; -BEGIN { - eval "use SUPER 1.10"; - plan skip_all => "SUPER 1.10 required for this test" if $@; -} +use Test::Requires { + 'SUPER' => 1.10, # skip all if not installed +}; =pod diff --git a/t/107_C3MethodDispatchOrder_test.t b/t/107_C3MethodDispatchOrder_test.t index d5ef265..32db56b 100644 --- a/t/107_C3MethodDispatchOrder_test.t +++ b/t/107_C3MethodDispatchOrder_test.t @@ -5,9 +5,11 @@ use Test::More; use File::Spec; use Class::MOP; +use Test::Requires { + 'Algorithm::C3' => '0.01', # skip all if not installed +}; + BEGIN { - eval "use Algorithm::C3"; - plan skip_all => "Algorithm::C3 required for this test" if $@; require_ok(File::Spec->catfile('examples', 'C3MethodDispatchOrder.pod')); } diff --git a/t/310_inline_structor.t b/t/310_inline_structor.t index 8e1b055..a1f3e64 100644 --- a/t/310_inline_structor.t +++ b/t/310_inline_structor.t @@ -3,10 +3,9 @@ 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 +}; use Class::MOP; diff --git a/t/312_anon_class_leak.t b/t/312_anon_class_leak.t index 46bcf7e..750c584 100644 --- a/t/312_anon_class_leak.t +++ b/t/312_anon_class_leak.t @@ -4,10 +4,9 @@ use warnings; use Class::MOP; use Test::More; -BEGIN { - eval "use Test::LeakTrace;"; - plan skip_all => "Test::LeakTrace is required for this test" if $@; -} +use Test::Requires { + 'Test::LeakTrace' => '0.01', # skip all if not installed +}; # 5.10.0 has a bug on weaken($hash_ref) which leaks an AV. my $expected = ( $] == 5.010_000 ? 1 : 0 ); diff --git a/xt/author/pod.t b/xt/author/pod.t index 69d8e60..2c2651a 100644 --- a/xt/author/pod.t +++ b/xt/author/pod.t @@ -3,7 +3,8 @@ use warnings; 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(); diff --git a/xt/author/pod_coverage.t b/xt/author/pod_coverage.t index bb4c6c6..42d7426 100644 --- a/xt/author/pod_coverage.t +++ b/xt/author/pod_coverage.t @@ -5,8 +5,9 @@ use warnings; 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. diff --git a/xt/author/tabs.t b/xt/author/tabs.t index cf75fd2..8eb3405 100644 --- a/xt/author/tabs.t +++ b/xt/author/tabs.t @@ -5,8 +5,9 @@ use warnings; 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 +}; for my $file ( qw( mop.c mop.h ), glob "xs/*xs" ) { notabs_ok( $file, "$file is tab free" );