remove unneeded shebangs
[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;
27f1eb75 28use Test::NoWarnings 1.04 ':early';
9381ff3c 29plan tests => 4;
30
df491f72 31ok( (my $instance = MyClass->new), 'instance' );
32
4239a8b1 33TODO: {
34 local $TODO = 'need rafl to help with implementation';
35
dfab7c8b 36 is( exception {
4239a8b1 37 is $instance->foo(foo => "text", bar => 42), '4 42';
9381ff3c 38 }, undef, 'method called with coerced and uncoerced parameters' )
39 or todo_skip 'is() test never ran', 1;
4239a8b1 40}