Revert "convert all uses of Test::Exception to Test::Fatal."
[gitmo/Class-MOP.git] / t / 070_immutable_metaclass.t
index f926ad3..74d470a 100644 (file)
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Fatal;
+use Test::Exception;
 
 use Class::MOP;
 
@@ -83,43 +83,43 @@ use Class::MOP;
 
     isa_ok( $meta, 'Class::MOP::Class' );
 
-    ok exception { $meta->add_method() }, '... exception thrown as expected';
-    ok exception { $meta->alias_method() }, '... exception thrown as expected';
-    ok exception { $meta->remove_method() }, '... exception thrown as expected';
+    dies_ok { $meta->add_method() } '... exception thrown as expected';
+    dies_ok { $meta->alias_method() } '... exception thrown as expected';
+    dies_ok { $meta->remove_method() } '... exception thrown as expected';
 
-    ok exception { $meta->add_attribute() }, '... exception thrown as expected';
-    ok exception { $meta->remove_attribute() }, '... exception thrown as expected';
+    dies_ok { $meta->add_attribute() } '... exception thrown as expected';
+    dies_ok { $meta->remove_attribute() } '... exception thrown as expected';
 
-    ok exception { $meta->add_package_symbol() },
+    dies_ok { $meta->add_package_symbol() }
     '... exception thrown as expected';
-    ok exception { $meta->remove_package_symbol() },
+    dies_ok { $meta->remove_package_symbol() }
     '... exception thrown as expected';
 
-    ok ! exception { $meta->identifier() },
+    lives_ok { $meta->identifier() }
     '... no exception for get_package_symbol special case';
 
     my @supers;
-    ok ! exception {
+    lives_ok {
         @supers = $meta->superclasses;
-    },
+    }
     '... got the superclasses okay';
 
-    ok exception { $meta->superclasses( ['UNIVERSAL'] ) },
+    dies_ok { $meta->superclasses( ['UNIVERSAL'] ) }
     '... but could not set the superclasses okay';
 
     my $meta_instance;
-    ok ! exception {
+    lives_ok {
         $meta_instance = $meta->get_meta_instance;
-    },
+    }
     '... got the meta instance okay';
     isa_ok( $meta_instance, 'Class::MOP::Instance' );
     is( $meta_instance, $meta->get_meta_instance,
         '... and we know it is cached' );
 
     my @cpl;
-    ok ! exception {
+    lives_ok {
         @cpl = $meta->class_precedence_list;
-    },
+    }
     '... got the class precedence list okay';
     is_deeply(
         \@cpl,
@@ -128,9 +128,9 @@ use Class::MOP;
     );
 
     my @attributes;
-    ok ! exception {
+    lives_ok {
         @attributes = $meta->get_all_attributes;
-    },
+    }
     '... got the attribute list okay';
     is_deeply(
         \@attributes,
@@ -146,9 +146,9 @@ use Class::MOP;
     ok( $meta->is_mutable,    '... our class is mutable' );
     ok( !$meta->is_immutable, '... our class is not immutable' );
 
-    ok ! exception {
+    lives_ok {
         $meta->make_immutable();
-    },
+    }
     '... changed Bar to be immutable';
 
     ok( !$meta->make_immutable, '... make immutable now returns nothing' );
@@ -158,40 +158,40 @@ use Class::MOP;
 
     isa_ok( $meta, 'Class::MOP::Class' );
 
-    ok exception { $meta->add_method() }, '... exception thrown as expected';
-    ok exception { $meta->alias_method() }, '... exception thrown as expected';
-    ok exception { $meta->remove_method() }, '... exception thrown as expected';
+    dies_ok { $meta->add_method() } '... exception thrown as expected';
+    dies_ok { $meta->alias_method() } '... exception thrown as expected';
+    dies_ok { $meta->remove_method() } '... exception thrown as expected';
 
-    ok exception { $meta->add_attribute() }, '... exception thrown as expected';
-    ok exception { $meta->remove_attribute() }, '... exception thrown as expected';
+    dies_ok { $meta->add_attribute() } '... exception thrown as expected';
+    dies_ok { $meta->remove_attribute() } '... exception thrown as expected';
 
-    ok exception { $meta->add_package_symbol() },
+    dies_ok { $meta->add_package_symbol() }
     '... exception thrown as expected';
-    ok exception { $meta->remove_package_symbol() },
+    dies_ok { $meta->remove_package_symbol() }
     '... exception thrown as expected';
 
     my @supers;
-    ok ! exception {
+    lives_ok {
         @supers = $meta->superclasses;
-    },
+    }
     '... got the superclasses okay';
 
-    ok exception { $meta->superclasses( ['UNIVERSAL'] ) },
+    dies_ok { $meta->superclasses( ['UNIVERSAL'] ) }
     '... but could not set the superclasses okay';
 
     my $meta_instance;
-    ok ! exception {
+    lives_ok {
         $meta_instance = $meta->get_meta_instance;
-    },
+    }
     '... got the meta instance okay';
     isa_ok( $meta_instance, 'Class::MOP::Instance' );
     is( $meta_instance, $meta->get_meta_instance,
         '... and we know it is cached' );
 
     my @cpl;
-    ok ! exception {
+    lives_ok {
         @cpl = $meta->class_precedence_list;
-    },
+    }
     '... got the class precedence list okay';
     is_deeply(
         \@cpl,
@@ -200,9 +200,9 @@ use Class::MOP;
     );
 
     my @attributes;
-    ok ! exception {
+    lives_ok {
         @attributes = $meta->get_all_attributes;
-    },
+    }
     '... got the attribute list okay';
     is_deeply(
         [ sort { $a->name cmp $b->name } @attributes ],
@@ -218,9 +218,9 @@ use Class::MOP;
     ok( $meta->is_mutable,    '... our class is mutable' );
     ok( !$meta->is_immutable, '... our class is not immutable' );
 
-    ok ! exception {
+    lives_ok {
         $meta->make_immutable();
-    },
+    }
     '... changed Baz to be immutable';
 
     ok( !$meta->make_immutable, '... make immutable now returns nothing' );
@@ -230,40 +230,40 @@ use Class::MOP;
 
     isa_ok( $meta, 'Class::MOP::Class' );
 
-    ok exception { $meta->add_method() }, '... exception thrown as expected';
-    ok exception { $meta->alias_method() }, '... exception thrown as expected';
-    ok exception { $meta->remove_method() }, '... exception thrown as expected';
+    dies_ok { $meta->add_method() } '... exception thrown as expected';
+    dies_ok { $meta->alias_method() } '... exception thrown as expected';
+    dies_ok { $meta->remove_method() } '... exception thrown as expected';
 
-    ok exception { $meta->add_attribute() }, '... exception thrown as expected';
-    ok exception { $meta->remove_attribute() }, '... exception thrown as expected';
+    dies_ok { $meta->add_attribute() } '... exception thrown as expected';
+    dies_ok { $meta->remove_attribute() } '... exception thrown as expected';
 
-    ok exception { $meta->add_package_symbol() },
+    dies_ok { $meta->add_package_symbol() }
     '... exception thrown as expected';
-    ok exception { $meta->remove_package_symbol() },
+    dies_ok { $meta->remove_package_symbol() }
     '... exception thrown as expected';
 
     my @supers;
-    ok ! exception {
+    lives_ok {
         @supers = $meta->superclasses;
-    },
+    }
     '... got the superclasses okay';
 
-    ok exception { $meta->superclasses( ['UNIVERSAL'] ) },
+    dies_ok { $meta->superclasses( ['UNIVERSAL'] ) }
     '... but could not set the superclasses okay';
 
     my $meta_instance;
-    ok ! exception {
+    lives_ok {
         $meta_instance = $meta->get_meta_instance;
-    },
+    }
     '... got the meta instance okay';
     isa_ok( $meta_instance, 'Class::MOP::Instance' );
     is( $meta_instance, $meta->get_meta_instance,
         '... and we know it is cached' );
 
     my @cpl;
-    ok ! exception {
+    lives_ok {
         @cpl = $meta->class_precedence_list;
-    },
+    }
     '... got the class precedence list okay';
     is_deeply(
         \@cpl,
@@ -272,9 +272,9 @@ use Class::MOP;
     );
 
     my @attributes;
-    ok ! exception {
+    lives_ok {
         @attributes = $meta->get_all_attributes;
-    },
+    }
     '... got the attribute list okay';
     is_deeply(
         [ sort { $a->name cmp $b->name } @attributes ],