foo
[gitmo/Class-MOP.git] / t / 102_InsideOutClass_test.t
index 658930e..4788dfc 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 65;
+use Test::More tests => 85;
 use File::Spec;
 
 BEGIN { 
@@ -18,6 +18,7 @@ BEGIN {
     use warnings;    
     
     use metaclass (
+        ':attribute_metaclass' => 'InsideOutClass::Attribute',
         ':instance_metaclass'  => 'InsideOutClass::Instance'
     );
     
@@ -54,7 +55,8 @@ BEGIN {
     use strict;
     use warnings;
     use metaclass (     
-        ':instance_metaclass' => 'InsideOutClass::Instance'
+        ':attribute_metaclass' => 'InsideOutClass::Attribute',
+        ':instance_metaclass'  => 'InsideOutClass::Instance'
     );
     
     Baz->meta->add_attribute('bling' => (
@@ -173,3 +175,34 @@ is($baz->foo(), 'This is Bar::Baz::foo', '... Bar::Baz::foo == "This is Bar"');
 is($baz->get_bar(), 'FOO is BAR', '... Bar::Baz::bar has been initialized');
 is($baz->bling(), 'Baz::bling', '... Bar::Baz::bling has been initialized');
 
+{
+    no strict 'refs';
+    
+    ok(*{'Foo::foo'}{HASH}, '... there is a foo package variable in Foo');
+    ok(*{'Foo::bar'}{HASH}, '... there is a bar package variable in Foo');
+
+    is(scalar(keys(%{'Foo::foo'})), 4, '... got the right number of entries for Foo::foo');
+    is(scalar(keys(%{'Foo::bar'})), 4, '... got the right number of entries for Foo::bar');    
+
+    ok(!*{'Bar::foo'}{HASH}, '... no foo package variable in Bar');
+    ok(!*{'Bar::bar'}{HASH}, '... no bar package variable in Bar');
+    ok(*{'Bar::baz'}{HASH}, '... there is a baz package variable in Bar');
+
+    is(scalar(keys(%{'Bar::foo'})), 0, '... got the right number of entries for Bar::foo');
+    is(scalar(keys(%{'Bar::bar'})), 0, '... got the right number of entries for Bar::bar');
+    is(scalar(keys(%{'Bar::baz'})), 2, '... got the right number of entries for Bar::baz');
+    
+    ok(*{'Baz::bling'}{HASH}, '... there is a bar package variable in Baz');
+
+    is(scalar(keys(%{'Baz::bling'})), 1, '... got the right number of entries for Baz::bling');        
+    
+    ok(!*{'Bar::Baz::foo'}{HASH}, '... no foo package variable in Bar::Baz');
+    ok(!*{'Bar::Baz::bar'}{HASH}, '... no bar package variable in Bar::Baz');
+    ok(!*{'Bar::Baz::baz'}{HASH}, '... no baz package variable in Bar::Baz');
+    ok(!*{'Bar::Baz::bling'}{HASH}, '... no bar package variable in Baz::Baz');
+
+    is(scalar(keys(%{'Bar::Baz::foo'})), 0, '... got the right number of entries for Bar::Baz::foo');
+    is(scalar(keys(%{'Bar::Baz::bar'})), 0, '... got the right number of entries for Bar::Baz::bar');
+    is(scalar(keys(%{'Bar::Baz::baz'})), 0, '... got the right number of entries for Bar::Baz::baz');    
+    is(scalar(keys(%{'Bar::Baz::bling'})), 0, '... got the right number of entries for Bar::Baz::bling');        
+}
\ No newline at end of file