Moose compat: throw an error on $self->reader(value)
[gitmo/Mouse.git] / t / 007-attributes.t
index cf2b5a7..4316e25 100644 (file)
@@ -2,6 +2,7 @@
 use strict;
 use warnings;
 use Test::More tests => 10;
+use Test::Exception;
 
 do {
     package Class;
@@ -27,7 +28,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);