Commit | Line | Data |
df491f72 |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | |
73760f48 |
5 | use Test::More tests => 3; |
df491f72 |
6 | |
73760f48 |
7 | use Test::Requires { |
8 | 'MooseX::Method::Signatures' => 0.01, |
9 | }; |
df491f72 |
10 | |
0d42c8e8 |
11 | use Test::Exception; |
12 | use Test::NoWarnings; |
13 | |
df491f72 |
14 | { |
15 | package MyClass; |
16 | use Moose; |
17 | use MooseX::Method::Signatures; |
18 | use MooseX::AlwaysCoerce; |
19 | use Moose::Util::TypeConstraints; |
20 | |
21 | BEGIN { |
22 | subtype 'MyType', as 'Int'; |
23 | coerce 'MyType', from 'Str', via { length $_ }; |
24 | |
25 | subtype 'Uncoerced', as 'Int'; |
26 | } |
27 | |
28 | method foo (MyType :$foo, Uncoerced :$bar) { |
29 | return "$foo $bar"; |
30 | } |
31 | } |
32 | |
33 | ok( (my $instance = MyClass->new), 'instance' ); |
34 | |
4239a8b1 |
35 | TODO: { |
36 | local $TODO = 'need rafl to help with implementation'; |
37 | |
38 | lives_and { |
39 | is $instance->foo(foo => "text", bar => 42), '4 42'; |
40 | } 'method called with coerced and uncoerced parameters'; |
41 | } |