simplify more stuff
[gitmo/Class-MOP.git] / t / 072_immutable_w_constructors.t
index 370787d..cb95e20 100644 (file)
@@ -1,8 +1,8 @@
 use strict;
 use warnings;
 
-use Test::More tests => 79;
-use Test::Exception;
+use Test::More;
+use Test::Fatal;
 
 use Class::MOP;
 
@@ -76,17 +76,17 @@ use Class::MOP;
         isa_ok($bar_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($bar_accessor, 'Class::MOP::Method');
 
-#        ok(!$bar_accessor->is_inline, '... the bar accessor is not inlined');
+        ok(!$bar_accessor->is_inline, '... the bar accessor is not inlined');
     }
 
     ok(!$meta->is_immutable, '... our class is not immutable');
 
-    lives_ok {
+    is( exception {
         $meta->make_immutable(
             inline_constructor => 1,
             inline_accessors   => 0,
         );
-    } '... changed Foo to be immutable';
+    }, undef, '... changed Foo to be immutable' );
 
     ok($meta->is_immutable, '... our class is now immutable');
     isa_ok($meta, 'Class::MOP::Class');
@@ -122,7 +122,7 @@ use Class::MOP;
         isa_ok($bar_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($bar_accessor, 'Class::MOP::Method');
 
-#        ok(!$bar_accessor->is_inline, '... the bar accessor is still not inlined');
+        ok(!$bar_accessor->is_inline, '... the bar accessor is still not inlined');
     }
 }
 
@@ -135,23 +135,23 @@ use Class::MOP;
         isa_ok($bar_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($bar_accessor, 'Class::MOP::Method');
 
-#        ok(!$bar_accessor->is_inline, '... the bar accessor is not inlined');
+        ok(!$bar_accessor->is_inline, '... the bar accessor is not inlined');
 
         my $baz_accessor = $meta->get_method('baz');
         isa_ok($baz_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($baz_accessor, 'Class::MOP::Method');
 
-#        ok(!$baz_accessor->is_inline, '... the baz accessor is not inlined');
+        ok(!$baz_accessor->is_inline, '... the baz accessor is not inlined');
     }
 
     ok(!$meta->is_immutable, '... our class is not immutable');
 
-    lives_ok {
+    is( exception {
         $meta->make_immutable(
             inline_constructor => 1,
             inline_accessors   => 1,
         );
-    } '... changed Bar to be immutable';
+    }, undef, '... changed Bar to be immutable' );
 
     ok($meta->is_immutable, '... our class is now immutable');
     isa_ok($meta, 'Class::MOP::Class');
@@ -179,13 +179,13 @@ use Class::MOP;
         isa_ok($bar_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($bar_accessor, 'Class::MOP::Method');
 
-#        ok(!$bar_accessor->is_inline, '... the bar accessor is still not inlined');
+        ok(!$bar_accessor->is_inline, '... the bar accessor is still not inlined');
 
         my $baz_accessor = $meta->get_method('baz');
         isa_ok($baz_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($baz_accessor, 'Class::MOP::Method');
 
-#        ok($baz_accessor->is_inline, '... the baz accessor is not inlined');
+        ok($baz_accessor->is_inline, '... the baz accessor is not inlined');
     }
 }
 
@@ -198,29 +198,29 @@ use Class::MOP;
         isa_ok($bar_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($bar_accessor, 'Class::MOP::Method');
 
-#        ok(!$bar_accessor->is_inline, '... the bar accessor is not inlined');
+        ok(!$bar_accessor->is_inline, '... the bar accessor is not inlined');
 
         my $baz_accessor = $meta->find_method_by_name('baz');
         isa_ok($baz_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($baz_accessor, 'Class::MOP::Method');
 
-#        ok($baz_accessor->is_inline, '... the baz accessor is inlined');
+        ok($baz_accessor->is_inline, '... the baz accessor is inlined');
 
         my $bah_accessor = $meta->get_method('bah');
         isa_ok($bah_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($bah_accessor, 'Class::MOP::Method');
 
-#        ok(!$bah_accessor->is_inline, '... the baz accessor is not inlined');
+        ok(!$bah_accessor->is_inline, '... the baz accessor is not inlined');
     }
 
     ok(!$meta->is_immutable, '... our class is not immutable');
 
-    lives_ok {
+    is( exception {
         $meta->make_immutable(
             inline_constructor => 0,
             inline_accessors   => 1,
         );
-    } '... changed Bar to be immutable';
+    }, undef, '... changed Bar to be immutable' );
 
     ok($meta->is_immutable, '... our class is now immutable');
     isa_ok($meta, 'Class::MOP::Class');
@@ -248,26 +248,26 @@ use Class::MOP;
         isa_ok($bar_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($bar_accessor, 'Class::MOP::Method');
 
-#        ok(!$bar_accessor->is_inline, '... the bar accessor is still not inlined');
+        ok(!$bar_accessor->is_inline, '... the bar accessor is still not inlined');
 
         my $baz_accessor = $meta->find_method_by_name('baz');
         isa_ok($baz_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($baz_accessor, 'Class::MOP::Method');
 
-#        ok($baz_accessor->is_inline, '... the baz accessor is not inlined');
+        ok($baz_accessor->is_inline, '... the baz accessor is not inlined');
 
         my $bah_accessor = $meta->get_method('bah');
         isa_ok($bah_accessor, 'Class::MOP::Method::Accessor');
         isa_ok($bah_accessor, 'Class::MOP::Method');
 
-#        ok($bah_accessor->is_inline, '... the baz accessor is not inlined');
+        ok($bah_accessor->is_inline, '... the baz accessor is not inlined');
     }
 }
 
 
 {
   my $buzz;
-  ::lives_ok { $buzz = Buzz->meta->new_object } '...Buzz instantiated successfully';
+  ::is( ::exception { $buzz = Buzz->meta->new_object }, undef, '...Buzz instantiated successfully' );
   ::ok(!$buzz->has_bar, '...bar is not set');
   ::is($buzz->bar, undef, '...bar returns undef');
   ::ok(!$buzz->has_bar, '...bar was not autovivified');
@@ -279,7 +279,7 @@ use Class::MOP;
   ::ok(!$buzz->has_bar, '...bar is no longerset');
 
   my $buzz2;
-  ::lives_ok { $buzz2 = Buzz->meta->new_object('bar' => undef) } '...Buzz instantiated successfully';
+  ::is( ::exception { $buzz2 = Buzz->meta->new_object('bar' => undef) }, undef, '...Buzz instantiated successfully' );
   ::ok($buzz2->has_bar, '...bar is set');
   ::is($buzz2->bar, undef, '...bar is undef');
 
@@ -287,13 +287,15 @@ use Class::MOP;
 
 {
   my $buzz;
-  ::lives_ok { $buzz = Buzz->meta->new_object } '...Buzz instantiated successfully';
+  ::is( ::exception { $buzz = Buzz->meta->new_object }, undef, '...Buzz instantiated successfully' );
   ::ok($buzz->has_bah, '...bah is set');
   ::is($buzz->bah, 'BAH', '...bah returns "BAH"' );
 
   my $buzz2;
-  ::lives_ok { $buzz2 = Buzz->meta->new_object('bah' => undef) } '...Buzz instantiated successfully';
+  ::is( ::exception { $buzz2 = Buzz->meta->new_object('bah' => undef) }, undef, '...Buzz instantiated successfully' );
   ::ok($buzz2->has_bah, '...bah is set');
   ::is($buzz2->bah, undef, '...bah is undef');
 
 }
+
+done_testing;