do not use same variable name twice.
[gitmo/Mouse.git] / t / 800_shikabased / 003-make_immutable.t
CommitLineData
fc1d8369 1use strict;
2use warnings;
3use Test::More tests => 4;
eab81545 4use Test::Exception;
fc1d8369 5
6{
7 package HardDog;
8 use Mouse;
9 has bone => (
10 is => 'rw',
11 required => 1,
12 );
13 no Mouse;
14 __PACKAGE__->meta->make_immutable;
15}
16
17{
18 package SoftDog;
19 use Mouse;
20 has bone => (
21 is => 'rw',
22 required => 1,
23 );
24 no Mouse;
25}
26
27lives_ok { SoftDog->new(bone => 'moo') };
28lives_ok { HardDog->new(bone => 'moo') };
29
30throws_ok { SoftDog->new() } qr/\QAttribute (bone) is required/;
31throws_ok { HardDog->new() } qr/\QAttribute (bone) is required/;
32