remove unused "use Try::Tiny"
[gitmo/MooseX-Types-Structured.git] / t / 04-map.t
CommitLineData
678b4064 1use strict;
2use warnings;
3use Test::More;
4
5use MooseX::Types::Moose qw(Int Num);
6use MooseX::Types::Structured qw(Map);
678b4064 7
8my $type = Map[ Int, Num ];
9
10ok($type->assert_valid({ 10 => 10.5 }), "simple Int -> Num mapping");
11
12eval { $type->assert_valid({ 10.5 => 10.5 }) };
13like($@, qr{value 10\.5}, "non-Int causes rejection on key");
14
15eval { $type->assert_valid({ 10 => "ten and a half" }) };
16like("$@", qr{value ten and a half}, "non-Num value causes rejection on value");
17
18ok($type->assert_valid({ }), "empty hashref is a valid mapping of any sort");
19
20done_testing;
21