From: Dave Rolsky Date: Mon, 6 Jul 2009 14:25:49 +0000 (-0500) Subject: Applied patch from Goro Fuji to fix leaks in creating an anonymous X-Git-Tag: 0.90~32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd326e2d2469bc38188bc7ff7244e17d342a8d34;p=gitmo%2FClass-MOP.git Applied patch from Goro Fuji to fix leaks in creating an anonymous class. --- diff --git a/t/312_anon_class_leak.t b/t/312_anon_class_leak.t new file mode 100644 index 0000000..14ac2d3 --- /dev/null +++ b/t/312_anon_class_leak.t @@ -0,0 +1,26 @@ +use strict; +use warnings; + +use Class::MOP; +use Test::More; + +BEGIN { + eval "use Test::LeakTrace;"; + plan skip_all => "Test::LeakTrace is required for this test" if $@; +} + +plan tests => 2; + +# 5.10.0 has a bug on weaken($hash_ref) which leaks an AV. +my $expected = ( $] == 5.010_000 ? 1 : 0 ); + +leaks_cmp_ok { + Class::MOP::Class->create_anon_class(); +} +'<=', $expected, 'create_anon_class()'; + +leaks_cmp_ok { + Class::MOP::Class->create_anon_class( superclasses => [qw(Exporter)] ); +} +'<=', $expected, 'create_anon_class(superclass => [...])'; +