X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F108_ArrayBasedStorage_test.t;h=9161f17863624a55b31996dded892b35d7c0e30c;hb=52e5f955631bd1734feae3659100757b7925cbb7;hp=efedf25afc8eb4fe48d8735c53342cadd5b760e0;hpb=10dd437b9a873b2fcbe64d908fcad09546480fd4;p=gitmo%2FClass-MOP.git diff --git a/t/108_ArrayBasedStorage_test.t b/t/108_ArrayBasedStorage_test.t index efedf25..9161f17 100644 --- a/t/108_ArrayBasedStorage_test.t +++ b/t/108_ArrayBasedStorage_test.t @@ -7,8 +7,7 @@ use Test::More tests => 72; use File::Spec; use Scalar::Util 'reftype'; -BEGIN { - use_ok('Class::MOP'); +BEGIN {use Class::MOP; require_ok(File::Spec->catfile('examples', 'ArrayBasedStorage.pod')); } @@ -39,6 +38,9 @@ BEGIN { } package Bar; + use metaclass ( + 'instance_metaclass' => 'ArrayBasedStorage::Instance', + ); use strict; use warnings; @@ -51,6 +53,9 @@ BEGIN { )); package Baz; + use metaclass ( + 'instance_metaclass' => 'ArrayBasedStorage::Instance', + ); use strict; use warnings; @@ -64,6 +69,9 @@ BEGIN { )); package Bar::Baz; + use metaclass ( + 'instance_metaclass' => 'ArrayBasedStorage::Instance', + ); use strict; use warnings; @@ -188,4 +196,9 @@ 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'); +Foo->meta->add_attribute( forgotten => is => "rw" ); + +my $new_baz = Bar::Baz->new; + +cmp_ok( scalar(@$new_baz), ">", scalar(@$baz), "additional slot due to refreshed meta instance" );