X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xt%2Fauthor%2Fmemory_leaks.t;h=d4e0a753043650d331999e3d40a2611ec36562c7;hb=c05704596921f27fba4b1148dfed3ddd0d15795e;hp=0c0d04a1251f4c734aae8bc96b7873b74e32cf84;hpb=1a1da8a348236f64318fb907515f351287d00730;p=gitmo%2FMoose.git diff --git a/xt/author/memory_leaks.t b/xt/author/memory_leaks.t index 0c0d04a..d4e0a75 100644 --- a/xt/author/memory_leaks.t +++ b/xt/author/memory_leaks.t @@ -7,6 +7,7 @@ use Test::Memory::Cycle; use Moose (); use Moose::Util qw( apply_all_roles ); +use Moose::Util::TypeConstraints; { package MyRole; @@ -99,4 +100,13 @@ no_leaks_ok( memory_cycle_ok($anon_role, 'anon role meta object is cycle-free' ); } +{ + my $Str = find_type_constraint('Str'); + my $Undef = find_type_constraint('Undef'); + my $Str_or_Undef = Moose::Meta::TypeConstraint::Union->new( + type_constraints => [ $Str, $Undef ] ); + memory_cycle_ok($Str_or_Undef, 'union types do not leak'); +} + + done_testing;