fixed tests to "pass" under latest MXRP (0.25); however todo tests still remain
[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 tests => 3;
6
7 use Test::Requires {
8     'MooseX::Method::Signatures' => 0.01,
9 };
10
11 use Test::Exception;
12 use Test::NoWarnings;
13
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
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 }