Redid conversion to Test::Fatal
[gitmo/Moose.git] / t / 050_metaclasses / 019_create_anon_with_required_attr.t
index 5603e1a..28e5202 100644 (file)
@@ -6,8 +6,8 @@
 use strict;
 use warnings;
 
-use Test::More tests => 15;
-use Test::Exception;
+use Test::More;
+use Test::Fatal;
 
 {
     package HasFoo;
@@ -30,29 +30,29 @@ use Test::Exception;
 package main;
 
 my $anon;
-lives_ok {
+is( exception {
     $anon = My::Metaclass->create_anon_class( foo => 'this' );
-} 'create anon class with required attr';
+}, undef, 'create anon class with required attr' );
 isa_ok( $anon, 'My::Metaclass' );
 cmp_ok( $anon->foo, 'eq', 'this', 'foo is this' );
-dies_ok {
+isnt( exception {
     $anon = My::Metaclass->create_anon_class();
-} 'failed to create anon class without required attr';
+}, undef, 'failed to create anon class without required attr' );
 
 my $meta;
-lives_ok {
+is( exception {
     $meta
         = My::Metaclass->initialize( 'Class::Name1' => ( foo => 'that' ) );
-} 'initialize a class with required attr';
+}, undef, 'initialize a class with required attr' );
 isa_ok( $meta, 'My::Metaclass' );
 cmp_ok( $meta->foo,  'eq', 'that',        'foo is that' );
 cmp_ok( $meta->name, 'eq', 'Class::Name1', 'for the correct class' );
-dies_ok {
+isnt( exception {
     $meta
         = My::Metaclass->initialize( 'Class::Name2' );
-} 'failed to initialize a class without required attr';
+}, undef, 'failed to initialize a class without required attr' );
 
-lives_ok {
+is( exception {
     eval qq{
         package Class::Name3;
         use metaclass 'My::Metaclass' => (
@@ -61,27 +61,28 @@ lives_ok {
         use Moose;
     };
     die $@ if $@;
-} 'use metaclass with required attr';
+}, undef, 'use metaclass with required attr' );
 $meta = Class::Name3->meta;
 isa_ok( $meta, 'My::Metaclass' );
 cmp_ok( $meta->foo,  'eq', 'another',        'foo is another' );
 cmp_ok( $meta->name, 'eq', 'Class::Name3', 'for the correct class' );
-dies_ok {
+isnt( exception {
     eval qq{
         package Class::Name4;
         use metaclass 'My::Metaclass';
         use Moose;
     };
     die $@ if $@;
-} 'failed to use metaclass without required attr';
+}, undef, 'failed to use metaclass without required attr' );
 
 
 # how do we pass a required attribute to -traits?
-dies_ok {
+isnt( exception {
     eval qq{
         package Class::Name5;
         use Moose -traits => 'HasFoo';
     };
     die $@ if $@;
-} 'failed to use trait without required attr';
+}, undef, 'failed to use trait without required attr' );
 
+done_testing;