X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F001_mouse%2F007-attributes.t;h=8e89df289ec64c244dde26decbd7e5d86898bd3b;hb=HEAD;hp=e4afacbb16a1600127c8602aa34e95000f1355bf;hpb=cfdb93c63c45d0e81e858631b62a7d4d7be87842;p=gitmo%2FMouse.git 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;