convert all uses of Test::Exception to Test::Fatal.
[gitmo/Moose.git] / t / 020_attributes / 008_attribute_type_unions.t
index 95ce5f9..ac30ddc 100644 (file)
@@ -3,97 +3,96 @@
 use strict;
 use warnings;
 
-use Test::More tests => 18;
-use Test::Exception;
-
+use Test::More;
+use Test::Fatal;
 
 
 {
     package Foo;
     use Moose;
-    
+
     has 'bar' => (is => 'rw', isa => 'ArrayRef | HashRef');
 }
 
 my $foo = Foo->new;
 isa_ok($foo, 'Foo');
 
-lives_ok {
+ok ! exception {
     $foo->bar([])
-} '... set bar successfully with an ARRAY ref';
+}, '... set bar successfully with an ARRAY ref';
 
-lives_ok {
+ok ! exception {
     $foo->bar({})
-} '... set bar successfully with a HASH ref';
+}, '... set bar successfully with a HASH ref';
 
-dies_ok {
+ok exception {
     $foo->bar(100)
-} '... couldnt set bar successfully with a number';
+}, '... couldnt set bar successfully with a number';
 
-dies_ok {
+ok exception {
     $foo->bar(sub {})
-} '... couldnt set bar successfully with a CODE ref';
+}, '... couldnt set bar successfully with a CODE ref';
 
 # check the constructor
 
-lives_ok {
+ok ! exception {
     Foo->new(bar => [])
-} '... created new Foo with bar successfully set with an ARRAY ref';
+}, '... created new Foo with bar successfully set with an ARRAY ref';
 
-lives_ok {
+ok ! exception {
     Foo->new(bar => {})
-} '... created new Foo with bar successfully set with a HASH ref';
+}, '... created new Foo with bar successfully set with a HASH ref';
 
-dies_ok {
+ok exception {
     Foo->new(bar => 50)
-} '... didnt create a new Foo with bar as a number';
+}, '... didnt create a new Foo with bar as a number';
 
-dies_ok {
+ok exception {
     Foo->new(bar => sub {})
-} '... didnt create a new Foo with bar as a CODE ref';
+}, '... didnt create a new Foo with bar as a CODE ref';
 
 {
     package Bar;
     use Moose;
-    
+
     has 'baz' => (is => 'rw', isa => 'Str | CodeRef');
 }
 
 my $bar = Bar->new;
 isa_ok($bar, 'Bar');
 
-lives_ok {
+ok ! exception {
     $bar->baz('a string')
-} '... set baz successfully with a string';
+}, '... set baz successfully with a string';
 
-lives_ok {
+ok ! exception {
     $bar->baz(sub { 'a sub' })
-} '... set baz successfully with a CODE ref';
+}, '... set baz successfully with a CODE ref';
 
-dies_ok {
+ok exception {
     $bar->baz(\(my $var1))
-} '... couldnt set baz successfully with a SCALAR ref';
+}, '... couldnt set baz successfully with a SCALAR ref';
 
-dies_ok {
+ok exception {
     $bar->baz({})
-} '... couldnt set bar successfully with a HASH ref';
+}, '... couldnt set bar successfully with a HASH ref';
 
 # check the constructor
 
-lives_ok {
+ok ! exception {
     Bar->new(baz => 'a string')
-} '... created new Bar with baz successfully set with a string';
+}, '... created new Bar with baz successfully set with a string';
 
-lives_ok {
+ok ! exception {
     Bar->new(baz => sub { 'a sub' })
-} '... created new Bar with baz successfully set with a CODE ref';
+}, '... created new Bar with baz successfully set with a CODE ref';
 
-dies_ok {
+ok exception {
     Bar->new(baz => \(my $var2))
-} '... didnt create a new Bar with baz as a number';
+}, '... didnt create a new Bar with baz as a number';
 
-dies_ok {
+ok exception {
     Bar->new(baz => {})
-} '... didnt create a new Bar with baz as a HASH ref';
-
+}, '... didnt create a new Bar with baz as a HASH ref';
 
+done_testing;