Commit | Line | Data |
---|---|---|
442e42ba | 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'; |