From: Dave Rolsky Date: Sun, 19 Feb 2012 18:25:34 +0000 (-0600) Subject: Add more memory leak tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b0b5ee125ca3981aba09219388466ce5c1ccde9;p=gitmo%2FMoose.git Add more memory leak tests --- diff --git a/t/bugs/memory_leaks.t b/t/bugs/memory_leaks.t index ed3334a..c5bcfd3 100644 --- a/t/bugs/memory_leaks.t +++ b/t/bugs/memory_leaks.t @@ -7,7 +7,8 @@ use Test::Requires { use Test::More; -use Moose; +use Moose (); +use Moose::Util qw( apply_all_roles ); { package MyRole; @@ -46,6 +47,21 @@ no_leaks_ok( no_leaks_ok( sub { + Moose::Meta::Role->create( 'MyRole2', roles => ['MyRole'] ); + }, + 'named role with roles is leak-free' +); + +no_leaks_ok( + sub { + my $object = Moose::Meta::Class->create('MyClass2')->new_object; + apply_all_roles( $object, 'MyRole' ); + }, + 'applying role to an instance is leak-free' +); + +no_leaks_ok( + sub { Moose::Meta::Role->create_anon_role; }, 'anonymous role is leak-free'