fix union with string types
[gitmo/MooseX-Types.git] / t / 20_union_with_string_type.t
CommitLineData
442e42ba 1#!/usr/bin/env perl
2use strict;
3use warnings;
4
5use Test::More tests => 1;
6
7my $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
21ok !$@, 'types are not mutated by union with a string type';