X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F011_create_class.t;h=1557927c34eb354c2ff6862d6bc9a39f8fdc81a7;hb=de0d4f939dec6cd53dcd304bb8dfca4f24ca47cb;hp=008cfa382c06710e8c09ab2d68f4b5f0491e6de4;hpb=1a7ebbb3e44301a39a8b5c57542ca8ae76a3e2d0;p=gitmo%2FClass-MOP.git diff --git a/t/011_create_class.t b/t/011_create_class.t index 008cfa3..1557927 100644 --- a/t/011_create_class.t +++ b/t/011_create_class.t @@ -3,14 +3,15 @@ use strict; use warnings; -use Test::More tests => 27; +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();