2d35debf6740ccdc5647f94f9b73fc665920627b
[gitmo/MooseX-Types.git] / t / 20_union_with_string_type.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4
5 use Test::More tests => 1;
6
7 my $exception;
8 {
9     package TypeLib;
10
11     use MooseX::Types -declare => [qw( MyUnionType MyStr )];
12     use MooseX::Types::Moose qw(Str Item);
13
14     subtype MyUnionType, as Str|'Int';
15     subtype MyStr, as Str;
16
17     eval { coerce MyStr, from Item, via {"$_"} };
18     $exception = $@;
19 }
20
21 ok !$@, 'types are not mutated by union with a string type';