From: Dave Rolsky Date: Mon, 8 Nov 2010 15:59:01 +0000 (-0600) Subject: Use done_testing in all tests and use Test::Requires X-Git-Tag: 0.25~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Types.git;a=commitdiff_plain;h=a344ca961b0a3507cfb5a4fc142c3d89c0bea1c7 Use done_testing in all tests and use Test::Requires --- diff --git a/Makefile.PL b/Makefile.PL index 06a4181..b0f7b89 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,10 +9,11 @@ license q{perl}; author q{Robert "phaylon" Sedlacek }; all_from q{lib/MooseX/Types.pm}; -build_requires q{Test::More}, '0.80'; +build_requires q{Test::More}, '0.88'; build_requires q{FindBin}, 0; build_requires q{Test::Moose}, 0; build_requires q{Test::Fatal}, 0; +build_requires q{Test::Requires}, 0; requires q{Moose}, '1.06'; requires q{Sub::Install}, '0.924'; diff --git a/t/10_moose-types.t b/t/10_moose-types.t index fd5508b..4039aca 100644 --- a/t/10_moose-types.t +++ b/t/10_moose-types.t @@ -9,8 +9,6 @@ use MooseX::Types::Moose ':all', 'Bool'; my @types = MooseX::Types::Moose->type_names; -plan tests => @types * 3; - for my $t (@types) { ok my $code = __PACKAGE__->can($t), "$t() was exported"; if ($code) { @@ -22,3 +20,4 @@ for my $t (@types) { ok __PACKAGE__->can("is_$t"), "is_$t() was exported"; } +done_testing; diff --git a/t/11_library-definition.t b/t/11_library-definition.t index 5aec836..484d597 100644 --- a/t/11_library-definition.t +++ b/t/11_library-definition.t @@ -13,8 +13,6 @@ my @tests = ( [ 'IntArrayRef', 12, [12], {}, [17, 23], {} ], ); -plan tests => (@tests * 8) + 5; - # new array ref so we can safely shift from it for my $data (map { [@$_] } @tests) { my $type = shift @$data; @@ -52,3 +50,5 @@ ok ! __PACKAGE__->can('to_TwentyThree'), "type without coercion doesn't have to_ eval { require TestNamespaceSep }; ok $@, q(trying to declare a type with '::' in it croaks); like $@, qr/Foo::Bar/, q(error message contains type name); + +done_testing; diff --git a/t/12_wrapper-definition.t b/t/12_wrapper-definition.t index f2d0f77..9284eec 100644 --- a/t/12_wrapper-definition.t +++ b/t/12_wrapper-definition.t @@ -17,8 +17,6 @@ my @tests = ( [ 'Str', 'Str', 12, "12", [], "foo", [777] ], ); -plan tests => (@tests * 9); - # new array ref so we can safely shift from it for my $data (map { [@$_] } @tests) { my $type = shift @$data; @@ -49,4 +47,4 @@ for my $data (map { [@$_] } @tests) { } } - +done_testing; diff --git a/t/13_typedecorator.t b/t/13_typedecorator.t index 949bf5a..1bf9329 100644 --- a/t/13_typedecorator.t +++ b/t/13_typedecorator.t @@ -2,7 +2,7 @@ use warnings; use strict; -use Test::More tests => 62; +use Test::More; use Test::Fatal; use FindBin; use lib "$FindBin::Bin/lib"; @@ -277,6 +277,4 @@ like exception { }, qr/Attribute \(WierdIntergersArrayRef2_attr\) does not pass the type constraint/ => 'Constraints properly fail'; - - - +done_testing(); diff --git a/t/14_compatibility-sub-exporter.t b/t/14_compatibility-sub-exporter.t index 1a250f1..04a233d 100644 --- a/t/14_compatibility-sub-exporter.t +++ b/t/14_compatibility-sub-exporter.t @@ -5,10 +5,7 @@ BEGIN { use FindBin; use lib "$FindBin::Bin/lib"; - eval "use Sub::Exporter"; - plan $@ - ? ( skip_all => "Tests require Sub::Exporter" ) - : ( tests => 3 ); + use Test::Requires { 'Sub::Exporter' => '0' }; } use SubExporterCompatibility qw(MyStr something); @@ -16,3 +13,5 @@ use SubExporterCompatibility qw(MyStr something); ok MyStr->check('aaa'), "Correctly passed"; ok !MyStr->check([1]), "Correctly fails"; ok something(), "Found the something method"; + +done_testing; diff --git a/t/15_recursion.t b/t/15_recursion.t index 6d81b73..4bafb43 100644 --- a/t/15_recursion.t +++ b/t/15_recursion.t @@ -20,7 +20,7 @@ BEGIN { package MooseX::Types::Test::Recursion::TestRunner; BEGIN { - use Test::More tests=>5; + use Test::More; ## Grab the newly created test type constraint MooseX::Types::Test::Recursion->import(':all'); @@ -48,10 +48,6 @@ BEGIN { ok ! RecursiveHashRef->check({key=>{subkey=>"value",subkey2=>{ssubkey=>[1,2,3]}}}) => 'Properly invalidates bad value deeply'; -} - - - - - + done_testing; +} diff --git a/t/16_introspection.t b/t/16_introspection.t index b4821e3..f2f04e4 100644 --- a/t/16_introspection.t +++ b/t/16_introspection.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More; use FindBin; use lib "$FindBin::Bin/lib"; @@ -56,3 +56,4 @@ is_deeply(IntrospectTypeExports->get_memory, [ ], 'all calls to has_available_type_export returned correct results'); +done_testing(); diff --git a/t/17_syntax_errors.t b/t/17_syntax_errors.t index 67d7432..fa6b853 100644 --- a/t/17_syntax_errors.t +++ b/t/17_syntax_errors.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More; # remove this when CheckedUtilExports croaks instead of carps $SIG{__WARN__} = sub { die @_ }; @@ -91,3 +91,5 @@ my $role_type = q{ }; eval $role_type; is $@, '', "declared role_types don't throw error"; + +done_testing(); diff --git a/t/18_combined_libs.t b/t/18_combined_libs.t index 23ba549..6ef2191 100644 --- a/t/18_combined_libs.t +++ b/t/18_combined_libs.t @@ -4,7 +4,7 @@ use warnings; use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 7; +use Test::More; use Test::Fatal; BEGIN { use_ok 'Combined', qw/Foo2Alias MTFNPY NonEmptyStr/ } @@ -35,3 +35,5 @@ qr/\Qmain asked for a type (NonExistentType) which is not found in any of the ty qr/Can't locate DoesNotExist\.pm/, 'cannot combine types from a package which does not exist'; } + +done_testing(); diff --git a/t/19_typelib_with_role.t b/t/19_typelib_with_role.t index af5acd0..b979d40 100644 --- a/t/19_typelib_with_role.t +++ b/t/19_typelib_with_role.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More; { package MyRole; @@ -24,3 +24,5 @@ eval q{ }; ok !$@, 'type export not picked up as a method on role application'; + +done_testing(); diff --git a/t/20_union_with_string_type.t b/t/20_union_with_string_type.t index 2b0bdfa..8147f86 100644 --- a/t/20_union_with_string_type.t +++ b/t/20_union_with_string_type.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More; my $exception; { @@ -48,3 +48,5 @@ my $exception; Test::More::ok !Test3->check({a=>1}), 'fails wrong ref type'; Test::More::ok Test3->check($obj), 'Union allows Object'; } + +done_testing(); diff --git a/t/21_coerce_parameterized_types.t b/t/21_coerce_parameterized_types.t index 4a25a1f..4a4cf9c 100644 --- a/t/21_coerce_parameterized_types.t +++ b/t/21_coerce_parameterized_types.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More; BEGIN { package TypeLib; @@ -46,3 +46,4 @@ BEGIN { ::ok( $subtype->has_coercion, 'coercion applied to subtype' ); } +done_testing(); diff --git a/t/regressions/01-is_subtype_of.t b/t/regressions/01-is_subtype_of.t index 87e5382..0fe59c1 100644 --- a/t/regressions/01-is_subtype_of.t +++ b/t/regressions/01-is_subtype_of.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests=>5; +use Test::More; use MooseX::Types; use MooseX::Types::Moose qw(Any Item ); @@ -20,3 +20,4 @@ ok ( Item->is_subtype_of('Any'), ok ( Item->is_subtype_of(Any), q[Item is subtype of Any]); +done_testing;