bump to 0.12 to fix upload *again*
[gitmo/MooseX-AlwaysCoerce.git] / t / 02-mx-m-s.t
CommitLineData
df491f72 1#!/usr/bin/env perl
2use strict;
3use warnings;
4
73760f48 5use Test::More tests => 3;
df491f72 6
73760f48 7use Test::Requires {
8 'MooseX::Method::Signatures' => 0.01,
9};
df491f72 10
0d42c8e8 11use Test::Exception;
12use 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
33ok( (my $instance = MyClass->new), 'instance' );
34
4239a8b1 35TODO: {
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}