X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F007-attributes.t;h=4edd2d0f156c5e7631f26a6338a1f23e672617de;hb=b20f7ca9c90953009e789c45ff6cff0e9571b8b5;hp=869ed335dcb91393c60e852dfcaf4f2c3ed0f27b;hpb=8c831d08b0d23c9dfcc4a85f6444915c988b5538;p=gitmo%2FMouse.git diff --git a/t/007-attributes.t b/t/007-attributes.t index 869ed33..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 Mouse::Util ':test'; +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; +