X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F102_InsideOutClass_test.t;h=d6b80d90006bbb5779f0e2dd23e9fc5d007c1f81;hb=00c93f7a35c441cd7101c95c185c9f2bfe62a3b2;hp=ffd36ebd0843240d31a33e3acb1bd304ad1dda97;hpb=62189f8484905d2cceec70b0a2a508a104e781d7;p=gitmo%2FClass-MOP.git diff --git a/t/102_InsideOutClass_test.t b/t/102_InsideOutClass_test.t index ffd36eb..d6b80d9 100644 --- a/t/102_InsideOutClass_test.t +++ b/t/102_InsideOutClass_test.t @@ -3,12 +3,12 @@ use strict; use warnings; -use Test::More tests => 85; +use Test::More tests => 88; use File::Spec; +use Scalar::Util 'reftype'; -BEGIN { - use_ok('Class::MOP'); - require_ok(File::Spec->catdir('examples', 'InsideOutClass.pod')); +BEGIN {use Class::MOP; + require_ok(File::Spec->catfile('examples', 'InsideOutClass.pod')); } { @@ -18,7 +18,8 @@ BEGIN { use warnings; use metaclass ( - ':instance_metaclass' => 'InsideOutClass::Instance' + 'attribute_metaclass' => 'InsideOutClass::Attribute', + 'instance_metaclass' => 'InsideOutClass::Instance' ); Foo->meta->add_attribute('foo' => ( @@ -38,6 +39,10 @@ BEGIN { } package Bar; + use metaclass ( + 'attribute_metaclass' => 'InsideOutClass::Attribute', + 'instance_metaclass' => 'InsideOutClass::Instance' + ); use strict; use warnings; @@ -54,7 +59,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' => ( @@ -63,6 +69,10 @@ BEGIN { )); package Bar::Baz; + use metaclass ( + 'attribute_metaclass' => 'InsideOutClass::Attribute', + 'instance_metaclass' => 'InsideOutClass::Instance' + ); use strict; use warnings; @@ -73,6 +83,8 @@ BEGIN { my $foo = Foo->new(); isa_ok($foo, 'Foo'); +is(reftype($foo), 'SCALAR', '... Foo is made with SCALAR'); + can_ok($foo, 'foo'); can_ok($foo, 'has_foo'); can_ok($foo, 'get_bar'); @@ -93,6 +105,8 @@ is($foo->get_bar(), 42, '... Foo::bar == 42'); my $foo2 = Foo->new(); isa_ok($foo2, 'Foo'); +is(reftype($foo2), 'SCALAR', '... Foo is made with SCALAR'); + ok(!$foo2->has_foo, '... Foo2::foo is not defined yet'); is($foo2->foo(), undef, '... Foo2::foo is not defined yet'); is($foo2->get_bar(), 'FOO is BAR', '... Foo2::bar has been initialized'); @@ -108,6 +122,8 @@ my $bar = Bar->new(); isa_ok($bar, 'Bar'); isa_ok($bar, 'Foo'); +is(reftype($bar), 'SCALAR', '... Bar is made with SCALAR'); + can_ok($bar, 'foo'); can_ok($bar, 'has_foo'); can_ok($bar, 'get_bar'); @@ -142,6 +158,8 @@ isa_ok($baz, 'Bar'); isa_ok($baz, 'Foo'); isa_ok($baz, 'Baz'); +is(reftype($baz), 'SCALAR', '... Bar::Baz is made with SCALAR'); + can_ok($baz, 'foo'); can_ok($baz, 'has_foo'); can_ok($baz, 'get_bar'); @@ -203,4 +221,4 @@ is($baz->bling(), 'Baz::bling', '... Bar::Baz::bling has been initialized'); 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 +}