X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F071_immutable_w_custom_metaclass.t;h=c81abb762a2bfab56fa4e95f73a75e536c4b2250;hb=f5433c0cde5348d0530895517037be49609dafea;hp=440f4000ee4c0de25ba9d07ec571e45910f9c81f;hpb=b5ade142030a79b9c102f3997814ba3f594d3897;p=gitmo%2FClass-MOP.git diff --git a/t/071_immutable_w_custom_metaclass.t b/t/071_immutable_w_custom_metaclass.t index 440f400..c81abb7 100644 --- a/t/071_immutable_w_custom_metaclass.t +++ b/t/071_immutable_w_custom_metaclass.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; @@ -12,9 +10,10 @@ use Scalar::Util; use Class::MOP; -use lib catdir($FindBin::Bin, 'lib'); +use lib catdir( $FindBin::Bin, 'lib' ); { + package Foo; use strict; @@ -37,29 +36,38 @@ use lib catdir($FindBin::Bin, 'lib'); use warnings; use metaclass 'MyMetaClass'; - sub mymetaclass_attributes{ - shift->meta->mymetaclass_attributes; + sub mymetaclass_attributes { + shift->meta->mymetaclass_attributes; } - ::lives_ok { - Baz->meta->superclasses('Bar'); - } '... we survive the metaclass incompatibility test'; + ::lives_ok{ Baz->meta->superclasses('Bar') } + '... we survive the metaclass incompatibility test'; } { my $meta = Baz->meta; - ok($meta->is_mutable, '... Baz is mutable'); - isnt(Scalar::Util::blessed(Foo->meta), Scalar::Util::blessed(Bar->meta), - 'Foo and Bar immutable metaclasses do not match'); - is(Scalar::Util::blessed($meta), 'MyMetaClass', 'Baz->meta blessed as MyMetaClass'); - ok(Baz->can('mymetaclass_attributes'), '... Baz can do method before immutable'); - ok($meta->can('mymetaclass_attributes'), '... meta can do method before immutable'); + ok( $meta->is_mutable, '... Baz is mutable' ); + is( + Scalar::Util::blessed( Foo->meta ), + Scalar::Util::blessed( Bar->meta ), + 'Foo and Bar immutable metaclasses match' + ); + is( Scalar::Util::blessed($meta), 'MyMetaClass', + 'Baz->meta blessed as MyMetaClass' ); + ok( Baz->can('mymetaclass_attributes'), + '... Baz can do method before immutable' ); + ok( $meta->can('mymetaclass_attributes'), + '... meta can do method before immutable' ); lives_ok { $meta->make_immutable } "Baz is now immutable"; - ok($meta->is_immutable, '... Baz is immutable'); - isa_ok($meta, 'MyMetaClass', 'Baz->meta'); - ok(Baz->can('mymetaclass_attributes'), '... Baz can do method after imutable'); - ok($meta->can('mymetaclass_attributes'), '... meta can do method after immutable'); - isnt(Scalar::Util::blessed(Baz->meta), Scalar::Util::blessed(Bar->meta), 'Baz and Bar immutable metaclasses are different'); + ok( $meta->is_immutable, '... Baz is immutable' ); + isa_ok( $meta, 'MyMetaClass', 'Baz->meta' ); + ok( Baz->can('mymetaclass_attributes'), + '... Baz can do method after imutable' ); + ok( $meta->can('mymetaclass_attributes'), + '... meta can do method after immutable' ); + isnt( Scalar::Util::blessed( Baz->meta ), + Scalar::Util::blessed( Bar->meta ), + 'Baz and Bar immutable metaclasses are different' ); lives_ok { $meta->make_mutable } "Baz is now mutable"; - ok($meta->is_mutable, '... Baz is mutable again'); + ok( $meta->is_mutable, '... Baz is mutable again' ); }