Commit | Line | Data |
86b99892 |
1 | use strict; |
2 | use warnings; |
3 | use Test::More tests => 2; |
4 | use Mouse::Util::TypeConstraints; |
5 | |
89a97ba1 |
6 | subtype 'Foo', as 'Object', where { $_->isa('A') }; |
86b99892 |
7 | |
8 | { |
9 | package A; |
10 | use Mouse; |
11 | has data => ( is => 'rw', isa => 'Str' ); |
12 | } |
13 | |
14 | { |
89a97ba1 |
15 | package C; |
86b99892 |
16 | use Mouse; |
17 | has a => ( is => 'rw', isa => 'Foo', coerce => 1 ); |
18 | } |
19 | |
89a97ba1 |
20 | isa_ok(C->new(a => A->new()), 'C'); |
21 | C->meta->make_immutable; |
22 | isa_ok(C->new(a => A->new()), 'C'); |
86b99892 |
23 | |