tiny change in metaclass.pm to automatically load custom metaclass
[gitmo/Class-MOP.git] / t / 011_create_class.t
index 66cb130..1557927 100644 (file)
@@ -3,14 +3,15 @@
 use strict;
 use warnings;
 
-use Test::More no_plan => 1;
+use Test::More tests => 28;
 use Test::Exception;
 
 BEGIN {
-    use_ok('Class::MOP', ':universal');        
+    use_ok('Class::MOP');        
 }
 
-my $Point = Class::MOP::Class->create('Point' => '0.01' => (
+my $Point = Class::MOP::Class->create('Point' => (
+    version    => '0.01',
     attributes => [
         Class::MOP::Attribute->new('$.x' => (
             reader   => 'x',
@@ -35,7 +36,8 @@ my $Point = Class::MOP::Class->create('Point' => '0.01' => (
     }
 ));
 
-my $Point3D = Class::MOP::Class->create('Point3D' => '0.01' => (
+my $Point3D = Class::MOP::Class->create('Point3D' => (
+    version      => '0.01',    
     superclasses => [ 'Point' ],
     attributes => [
         Class::MOP::Attribute->new('$:z' => (
@@ -75,7 +77,9 @@ is($point->y, 42, '... the $.y attribute was set properly with the accessor');
 
 is($point->x, 2, '... the $.x attribute was initialized correctly through the metaobject');
 
-$point->x(42);
+dies_ok {
+    $point->x(42);
+} '... cannot write to a read-only accessor';
 is($point->x, 2, '... the $.x attribute was not altered');
 
 $point->clear();