clone and rebless when wrapping a method object
[gitmo/Class-MOP.git] / t / 070_immutable_metaclass.t
index 4ec34fc..8d57f5d 100644 (file)
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 80;
+use Test::More tests => 73;
 use Test::Exception;
 
 use Class::MOP;
@@ -42,37 +42,16 @@ use Class::MOP;
 
     $meta->make_immutable;
 
-    my $transformer = $meta->immutable_transformer;
-    isa_ok( $transformer, 'Class::MOP::Immutable',
-        '... transformer isa Class::MOP::Immutable' );
-
-    my $immutable_metaclass = $transformer->immutable_metaclass;
-    is( $transformer->metaclass, $meta,
-        '... transformer has correct metaclass' );
-    ok( $transformer->inlined_constructor,
-        '... transformer says it did inline the constructor' );
-    ok( $immutable_metaclass->is_anon_class,
-        '... immutable_metaclass is an anonymous class' );
-
-    #I don't understand why i need to ->meta here...
-    my $obj = $immutable_metaclass->name;
-    ok( !$obj->is_mutable,  '... immutable_metaclass is not mutable' );
-    ok( $obj->is_immutable, '... immutable_metaclass is immutable' );
-    ok( !$obj->make_immutable,
-        '... immutable_metaclass make_mutable is noop' );
-    is( $obj->meta, $immutable_metaclass,
-        '... immutable_metaclass meta hack works' );
+    my $immutable_metaclass = $meta->_immutable_metaclass->meta;
 
-    is_deeply(
-        [ $immutable_metaclass->superclasses ],
-        [ $original_metaclass_name ],
-        '... immutable_metaclass superclasses are correct'
-    );
-    ok(
-        $immutable_metaclass->has_method('get_mutable_metaclass_name'),
-        'immutable metaclass has get_mutable_metaclass_name method'
-    );
+    my $immutable_class_name = $immutable_metaclass->name;
 
+    ok( !$immutable_class_name->is_mutable,  '... immutable_metaclass is not mutable' );
+    ok( $immutable_class_name->is_immutable, '... immutable_metaclass is immutable' );
+    is( $immutable_class_name->meta, $immutable_metaclass,
+        '... immutable_metaclass meta hack works' );
+
+    isa_ok( $meta, "Class::MOP::Class" );
 }
 
 {
@@ -82,11 +61,6 @@ use Class::MOP;
     ok( !$meta->is_mutable,    '... our class is not mutable' );
     ok( $meta->is_immutable, '... our class is immutable' );
 
-    my $transformer = $meta->immutable_transformer;
-
-    is( $transformer, $meta->immutable_transformer,
-        '... immutable transformer cache works' );
-
     isa_ok( $meta, 'Class::MOP::Class' );
 
     dies_ok { $meta->add_method() } '... exception thrown as expected';
@@ -135,7 +109,7 @@ use Class::MOP;
 
     my @attributes;
     lives_ok {
-        @attributes = $meta->compute_all_applicable_attributes;
+        @attributes = $meta->get_all_attributes;
     }
     '... got the attribute list okay';
     is_deeply(
@@ -207,7 +181,7 @@ use Class::MOP;
 
     my @attributes;
     lives_ok {
-        @attributes = $meta->compute_all_applicable_attributes;
+        @attributes = $meta->get_all_attributes;
     }
     '... got the attribute list okay';
     is_deeply(
@@ -279,7 +253,7 @@ use Class::MOP;
 
     my @attributes;
     lives_ok {
-        @attributes = $meta->compute_all_applicable_attributes;
+        @attributes = $meta->get_all_attributes;
     }
     '... got the attribute list okay';
     is_deeply(