Commit | Line | Data |
fc1d8369 |
1 | use strict; |
2 | use warnings; |
63d74d7a |
3 | use Test::More tests => 6; |
eab81545 |
4 | use Test::Exception; |
fc1d8369 |
5 | |
6 | { |
7 | package HardDog; |
8 | use Mouse; |
9 | has bone => ( |
10 | is => 'rw', |
11 | required => 1, |
12 | ); |
63d74d7a |
13 | sub BUILD { main::ok "calling BUILD in HardDog" } |
fc1d8369 |
14 | no Mouse; |
15 | __PACKAGE__->meta->make_immutable; |
16 | } |
17 | |
18 | { |
19 | package SoftDog; |
20 | use Mouse; |
21 | has bone => ( |
22 | is => 'rw', |
23 | required => 1, |
24 | ); |
63d74d7a |
25 | sub BUILD { main::ok "calling BUILD in SoftDog" } |
fc1d8369 |
26 | no Mouse; |
27 | } |
28 | |
29 | lives_ok { SoftDog->new(bone => 'moo') }; |
30 | lives_ok { HardDog->new(bone => 'moo') }; |
31 | |
32 | throws_ok { SoftDog->new() } qr/\QAttribute (bone) is required/; |
33 | throws_ok { HardDog->new() } qr/\QAttribute (bone) is required/; |
34 | |