X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F007-attributes.t;h=4edd2d0f156c5e7631f26a6338a1f23e672617de;hb=f6ac0f1c3bc93a7123ea6de1344db97970fcf670;hp=140d0db818c61d9bceeee37405e229aa373346df;hpb=3118622d182add6c88792d5de3b4af047e8a7c8c;p=gitmo%2FMouse.git diff --git a/t/007-attributes.t b/t/007-attributes.t index 140d0db..4edd2d0 100644 --- a/t/007-attributes.t +++ b/t/007-attributes.t @@ -1,14 +1,16 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 10; -use t::Exception; +use Test::More tests => 15; +use Test::Exception; do { package Class; use Mouse; - has 'x'; + has 'x' => ( + is => 'bare', + ); has 'y' => ( is => 'ro', @@ -17,6 +19,12 @@ do { has 'z' => ( is => 'rw', ); + + has 'attr' => ( + accessor => 'rw_attr', + reader => 'read_attr', + writer => 'write_attr', + ); }; ok(!Class->can('x'), "No accessor is injected if 'is' has no value"); @@ -39,3 +47,11 @@ is($object->z, undef); is($object->z(10), 10); is($object->z, 10); +can_ok($object, qw(rw_attr read_attr write_attr)); +$object->write_attr(42); +is $object->rw_attr, 42; +is $object->read_attr, 42; +$object->rw_attr(100); +is $object->rw_attr, 100; +is $object->read_attr, 100; +