Redid conversion to Test::Fatal
[gitmo/Moose.git] / t / 040_type_constraints / 019_coerced_parameterized_types.t
index 9010448..e4386e6 100644 (file)
@@ -3,8 +3,8 @@
 use strict;
 use warnings;
 
-use Test::More tests => 11;
-use Test::Exception;
+use Test::More;
+use Test::Fatal;
 
 BEGIN {
     use_ok("Moose::Util::TypeConstraints");
@@ -26,13 +26,13 @@ BEGIN {
 
 subtype 'MyList' => as 'Object' => where { $_->isa('MyList') };
 
-lives_ok {
+is( exception {
     coerce 'ArrayRef'
         => from 'MyList'
             => via { [ $_->items ] }
-} '... created the coercion okay';
+}, undef, '... created the coercion okay' );
 
-my $mylist = Moose::Util::TypeConstraints::find_or_create_type_constraint('MyList[Int]');
+my $mylist = Moose::Util::TypeConstraints::find_or_parse_type_constraint('MyList[Int]');
 
 ok($mylist->check(MyList->new(10, 20, 30)), '... validated it correctly (pass)');
 ok(!$mylist->check(MyList->new(10, "two")), '... validated it correctly (fail)');
@@ -43,16 +43,17 @@ subtype 'EvenList' => as 'MyList' => where { $_->items % 2 == 0 };
 # XXX: get this to work *without* the declaration. I suspect it'll be a new
 # method in Moose::Meta::TypeCoercion that will look at the parents of the
 # coerced type as well. but will that be too "action at a distance"-ey?
-lives_ok {
+is( exception {
     coerce 'ArrayRef'
         => from 'EvenList'
             => via { [ $_->items ] }
-} '... created the coercion okay';
+}, undef, '... created the coercion okay' );
 
-my $evenlist = Moose::Util::TypeConstraints::find_or_create_type_constraint('EvenList[Int]');
+my $evenlist = Moose::Util::TypeConstraints::find_or_parse_type_constraint('EvenList[Int]');
 
 ok(!$evenlist->check(MyList->new(10, 20, 30)), '... validated it correctly (fail)');
 ok($evenlist->check(MyList->new(10, 20, 30, 40)), '... validated it correctly (pass)');
 ok(!$evenlist->check(MyList->new(10, "two")), '... validated it correctly (fail)');
 ok(!$evenlist->check([10, 20]), '... validated it correctly (fail)');
 
+done_testing;