TODO-ify MX::Method::Signatures test
[gitmo/MooseX-AlwaysCoerce.git] / t / 02-mx-m-s.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4
5 use Test::More;
6 use Test::Exception;
7
8 BEGIN {
9     if (eval { require MooseX::Method::Signatures }) {
10         plan tests => 2;
11     } else {
12         plan skip_all => 'This test needs MooseX::Method::Signatures';
13     }
14 }
15
16 {
17     package MyClass;
18     use Moose;
19     use MooseX::Method::Signatures;
20     use MooseX::AlwaysCoerce;
21     use Moose::Util::TypeConstraints;
22
23     BEGIN {
24         subtype 'MyType', as 'Int';
25         coerce 'MyType', from 'Str', via { length $_ };
26
27         subtype 'Uncoerced', as 'Int';
28     }
29
30     method foo (MyType :$foo, Uncoerced :$bar) {
31         return "$foo $bar";
32     }
33 }
34
35 ok( (my $instance = MyClass->new), 'instance' );
36
37 TODO: {
38     local $TODO = 'need rafl to help with implementation';
39
40     lives_and {
41         is $instance->foo(foo => "text", bar => 42), '4 42';
42     } 'method called with coerced and uncoerced parameters';
43 }