X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=t%2F001_mouse%2F007-attributes.t;fp=t%2F001_mouse%2F007-attributes.t;h=8e89df289ec64c244dde26decbd7e5d86898bd3b;hp=e4afacbb16a1600127c8602aa34e95000f1355bf;hb=0464d337aad64f435f978dd97bc44af033545fac;hpb=c6a03cb1923f83f46d5e10a11baa13c188cef007 diff --git a/t/001_mouse/007-attributes.t b/t/001_mouse/007-attributes.t index e4afacb..8e89df2 100644 --- a/t/001_mouse/007-attributes.t +++ b/t/001_mouse/007-attributes.t @@ -29,6 +29,10 @@ do { reader => 'read_attr', writer => 'write_attr', ); + has 'attr2' => ( + is => 'rw', + accessor => 'rw_attr2', + ); }; with_immutable { ok(!Class->can('x'), "No accessor is injected if 'is' has no value"); @@ -66,6 +70,9 @@ with_immutable { is $object->write_attr("piyo"), "piyo"; is $object->rw_attr("yopi"), "yopi"; + can_ok $object, qw(rw_attr2); + ok !$object->can('attr2'), "doesn't have attr2"; + dies_ok { Class->rw_attr(); }; @@ -78,6 +85,6 @@ with_immutable { my @attrs = map { $_->name } sort { $a->insertion_order <=> $b->insertion_order } $object->meta->get_all_attributes; - is join(' ', @attrs), 'x y z attr', 'insertion_order'; + is join(' ', @attrs), 'x y z attr attr2', 'insertion_order'; } qw(Class); done_testing;