X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F022_attribute_duplication.t;h=b3246586a375a397fa147ff66c1c672e0030aca4;hb=07dca7e3186d90e9e7438b90c986c6508c785ccf;hp=3fa68b16bd00827213edf7dd630b76b35701f8ff;hpb=742fb371653d58d3aca4dccadcb7dd4e7c736354;p=gitmo%2FClass-MOP.git diff --git a/t/022_attribute_duplication.t b/t/022_attribute_duplication.t index 3fa68b1..b324658 100644 --- a/t/022_attribute_duplication.t +++ b/t/022_attribute_duplication.t @@ -5,7 +5,7 @@ use warnings; use Scalar::Util; -use Test::More tests => 29; +use Test::More tests => 17; BEGIN { use_ok('Class::MOP'); @@ -36,21 +36,7 @@ one first. ::is($bar_attr->reader, 'get_bar', '... the bar attribute has the reader get_bar'); ::is($bar_attr->writer, 'set_bar', '... the bar attribute has the writer set_bar'); - ::is($bar_attr->associated_class, Foo->meta, '... and the bar attribute is associated with Foo->meta'); - - ::is($bar_attr->get_read_method, 'get_bar', '... $attr does have an read method'); - ::is($bar_attr->get_write_method, 'set_bar', '... $attr does have an write method'); - - { - my $reader = $bar_attr->get_read_method_ref; - my $writer = $bar_attr->get_write_method_ref; - - ::isa_ok($reader, 'Class::MOP::Method'); - ::isa_ok($writer, 'Class::MOP::Method'); - - ::is(Scalar::Util::reftype($reader->body), 'CODE', '... it is a plain old sub'); - ::is(Scalar::Util::reftype($writer->body), 'CODE', '... it is a plain old sub'); - } + ::is($bar_attr->associated_class, Foo->meta, '... and the bar attribute is associated with Foo->meta'); Foo->meta->add_attribute('bar' => reader => 'assign_bar' @@ -61,21 +47,7 @@ one first. ::can_ok('Foo', 'assign_bar'); ::ok(Foo->meta->has_attribute('bar'), '... Foo still has the attribute bar'); - my $bar_attr2 = Foo->meta->get_attribute('bar'); - - ::is($bar_attr2->get_read_method, 'assign_bar', '... $attr does have an read method'); - ::ok(!$bar_attr2->get_write_method, '... $attr does have an write method'); - - { - my $reader = $bar_attr2->get_read_method_ref; - my $writer = $bar_attr2->get_write_method_ref; - - ::isa_ok($reader, 'Class::MOP::Method'); - ::ok(!Scalar::Util::blessed($writer), '... the writer method is not blessed though'); - - ::is(Scalar::Util::reftype($reader->body), 'CODE', '... it is a plain old sub'); - ::is(Scalar::Util::reftype($writer), 'CODE', '... it is a plain old sub'); - } + my $bar_attr2 = Foo->meta->get_attribute('bar'); ::isnt($bar_attr, $bar_attr2, '... this is a new bar attribute'); ::isnt($bar_attr->associated_class, Foo->meta, '... and the old bar attribute is no longer associated with Foo->meta');