X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F007-attributes.t;h=fdb3ed3091626895f6108a9dee64d2f4391a5152;hb=ab1a1cce52104e19f86fec43e8ffa9f008041ee5;hp=cf2b5a7365102b45a98529093f59e8889a4e40ca;hpb=c3398f5bd45f2851b7cd40ca9823bcf7d2378469;p=gitmo%2FMouse.git diff --git a/t/007-attributes.t b/t/007-attributes.t index cf2b5a7..fdb3ed3 100644 --- a/t/007-attributes.t +++ b/t/007-attributes.t @@ -2,12 +2,15 @@ use strict; use warnings; use Test::More tests => 10; +use Test::Exception; do { package Class; use Mouse; - has 'x'; + has 'x' => ( + is => 'bare', + ); has 'y' => ( is => 'ro', @@ -27,7 +30,11 @@ ok(!$object->can('x'), "No accessor is injected if 'is' has no value"); can_ok($object, 'y', 'z'); is($object->y, undef); -is($object->y(10), undef); + +throws_ok { + $object->y(10); +} qr/Cannot assign a value to a read-only accessor/; + is($object->y, undef); is($object->z, undef);