From: Jesse Luehrs Date: Mon, 27 Sep 2010 01:05:58 +0000 (-0500) Subject: pass no_meta in the tests where we hardcode method metaclasses X-Git-Tag: 1.09~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0bd3cf1ce3ad43b754975b0ea53717b37fadf25c;p=gitmo%2FClass-MOP.git pass no_meta in the tests where we hardcode method metaclasses --- diff --git a/t/049_metaclass_reinitialize.t b/t/049_metaclass_reinitialize.t index d4cb9c6..6cd6fb5 100644 --- a/t/049_metaclass_reinitialize.t +++ b/t/049_metaclass_reinitialize.t @@ -97,16 +97,16 @@ is(Bar->meta->get_attribute('bar')->tset, 'OOF'); { package Baz; - use metaclass; + use metaclass no_meta => 1; sub foo {} - Baz->meta->add_attribute('bar'); + Class::MOP::class_of('Baz')->add_attribute('bar'); } -$meta = Baz->meta; +$meta = Class::MOP::class_of('Baz'); check_meta_sanity($meta, 'Baz'); -ok(!Baz->meta->get_method('foo')->isa('Baz::Meta::Method')); -ok(!Baz->meta->get_attribute('bar')->isa('Baz::Meta::Attribute')); +ok(!$meta->get_method('foo')->isa('Baz::Meta::Method')); +ok(!$meta->get_attribute('bar')->isa('Baz::Meta::Attribute')); lives_ok { $meta = $meta->reinitialize( 'Baz', @@ -115,8 +115,8 @@ lives_ok { ); }; check_meta_sanity($meta, 'Baz'); -isa_ok(Baz->meta->get_method('foo'), 'Baz::Meta::Method'); -isa_ok(Baz->meta->get_attribute('bar'), 'Baz::Meta::Attribute'); +isa_ok($meta->get_method('foo'), 'Baz::Meta::Method'); +isa_ok($meta->get_attribute('bar'), 'Baz::Meta::Attribute'); { package Quux; @@ -182,22 +182,24 @@ ok(!$meta->has_method('bar')); { package Blah; - use metaclass; + use metaclass no_meta => 1; sub foo {} - __PACKAGE__->meta->add_attribute('bar'); + Class::MOP::class_of('Blah')->add_attribute('bar'); } -$meta = Blah->meta; +$meta = Class::MOP::class_of('Blah'); check_meta_sanity($meta, 'Blah'); -Class::MOP::Class->reinitialize( - 'Blah', - attribute_metaclass => 'Blah::Meta::Attribute', - method_metaclass => 'Blah::Meta::Method', -); +lives_ok { + $meta = Class::MOP::Class->reinitialize( + 'Blah', + attribute_metaclass => 'Blah::Meta::Attribute', + method_metaclass => 'Blah::Meta::Method', + ); +}; check_meta_sanity($meta, 'Blah'); -can_ok(Blah->meta->get_method('foo'), 'foo'); -is(Blah->meta->get_method('foo')->foo, 'TEST'); -can_ok(Blah->meta->get_attribute('bar'), 'oof'); -is(Blah->meta->get_attribute('bar')->oof, 'TSET'); +can_ok($meta->get_method('foo'), 'foo'); +is($meta->get_method('foo')->foo, 'TEST'); +can_ok($meta->get_attribute('bar'), 'oof'); +is($meta->get_attribute('bar')->oof, 'TSET'); done_testing;