do not let warnings kill an install
[gitmo/MooseX-AlwaysCoerce.git] / t / 02-mx-m-s.t
CommitLineData
df491f72 1use strict;
2use warnings;
3
9381ff3c 4use Test::More;
0d42c8e8 5
df491f72 6{
7 package MyClass;
8 use Moose;
9381ff3c 9 use Test::Requires {
10 'MooseX::Method::Signatures' => 0.01,
11 };
df491f72 12 use MooseX::AlwaysCoerce;
13 use Moose::Util::TypeConstraints;
14
15 BEGIN {
16 subtype 'MyType', as 'Int';
17 coerce 'MyType', from 'Str', via { length $_ };
18
19 subtype 'Uncoerced', as 'Int';
20 }
21
22 method foo (MyType :$foo, Uncoerced :$bar) {
23 return "$foo $bar";
24 }
25}
26
9381ff3c 27use Test::Fatal;
fc553705 28use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
9381ff3c 29
df491f72 30ok( (my $instance = MyClass->new), 'instance' );
31
4239a8b1 32TODO: {
33 local $TODO = 'need rafl to help with implementation';
34
dfab7c8b 35 is( exception {
4239a8b1 36 is $instance->foo(foo => "text", bar => 42), '4 42';
9381ff3c 37 }, undef, 'method called with coerced and uncoerced parameters' )
38 or todo_skip 'is() test never ran', 1;
4239a8b1 39}
fc553705 40
41done_testing;