update repo to point to github
[gitmo/Moo.git] / xt / moo-consume-mouse-role-coerce.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 {
6     package RoleOne;
7     use Mouse::Role;
8     use Mouse::Util::TypeConstraints;
9     use namespace::autoclean;
10
11     subtype 'Foo', as 'Int';
12     coerce 'Foo', from 'Str', via { 3 };
13
14     has foo => (
15         is => 'rw',
16         isa => 'Foo',
17         coerce => 1,
18         clearer => '_clear_foo',
19     );
20 }
21 {
22     package Class;
23     use Moo; # Works if use Moose..
24     use namespace::clean -except => 'meta';
25
26     with 'RoleOne';
27 }
28
29 my $i = Class->new( foo => 'bar' );
30 is $i->foo, 3;
31
32 done_testing;
33