renaming test
[gitmo/Class-MOP.git] / t / 006_new_and_clone_metaclasses.t
index 3646cf4..6e972d9 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 29;
+use Test::More tests => 36;
 use Test::Exception;
 
 BEGIN {
@@ -92,6 +92,11 @@ my $bar = $bar_meta->new_object();
 isa_ok($bar, 'Bar');
 isa_ok($bar, 'Foo');
 
+my $baz = $baz_meta->new_object();
+isa_ok($baz, 'Baz');
+isa_ok($baz, 'Bar');
+isa_ok($baz, 'Foo');
+
 my $cloned_foo = $foo_meta->clone_object($foo);
 isa_ok($cloned_foo, 'Foo');
 
@@ -103,3 +108,23 @@ dies_ok {
     $foo_meta->clone_object($meta);
 } '... this dies as expected';  
 
+# test stuff
+
+{
+    package FooBar;
+    use metaclass;
+    
+    FooBar->meta->add_attribute('test');
+}
+
+my $attr = FooBar->meta->get_attribute('test');
+isa_ok($attr, 'Class::MOP::Attribute');
+
+my $attr_clone = $attr->clone();
+isa_ok($attr_clone, 'Class::MOP::Attribute');
+
+isnt($attr, $attr_clone, '... we successfully cloned our attributes');
+is($attr->associated_class, 
+   $attr_clone->associated_class, 
+   '... we successfully did not clone our associated metaclass');
+