X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F023_attribute_get_read_write.t;h=cc08a5f386cfc3070a5bbd4c22efc4e7e4d45161;hb=61e7fef0bd8227073ed006ebfe59db3297a27afb;hp=f5faa90838dde220cb198e4731e3548a7102763f;hpb=d14f6cbe014dcba2caeca6d19a056074356ae534;p=gitmo%2FClass-MOP.git diff --git a/t/023_attribute_get_read_write.t b/t/023_attribute_get_read_write.t index f5faa90..cc08a5f 100644 --- a/t/023_attribute_get_read_write.t +++ b/t/023_attribute_get_read_write.t @@ -1,15 +1,11 @@ -#!/usr/bin/perl - use strict; use warnings; use Scalar::Util 'blessed', 'reftype'; -use Test::More tests => 35; +use Test::More tests => 36; -BEGIN { - use_ok('Class::MOP'); -} +use Class::MOP; =pod @@ -34,6 +30,14 @@ and get_read/write_method_ref methods Foo->meta->add_attribute('gorch' => reader => { 'get_gorch', => sub { (shift)->{gorch} } } ); + + package Bar; + use metaclass; + Bar->meta->superclasses('Foo'); + + Bar->meta->add_attribute('quux' => + accessor => 'quux', + ); } can_ok('Foo', 'get_bar'); @@ -100,7 +104,9 @@ ok(!$gorch_attr->get_write_method, '... $attr does not have an write method'); my $writer = $gorch_attr->get_write_method_ref; isa_ok($reader, 'Class::MOP::Method'); - ok(!blessed($writer), '... it is not a plain old sub'); + ok(blessed($writer), '... it is not a plain old sub'); + isa_ok($writer, 'Class::MOP::Method'); is($reader->fully_qualified_name, 'Foo::get_gorch', '... it is the sub we are looking for'); + is($writer->fully_qualified_name, 'Foo::__ANON__', '... it is the sub we are looking for'); }