summaryrefslogtreecommitdiff
path: root/t/cmop/anon_class_leak.t
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
commit5ac2026f7eed78958d69d051e7a8e993dcf51205 (patch)
tree298c3d2f08bdfe5689998b11892d72a897985be1 /t/cmop/anon_class_leak.t
downloadMoose-tarball-master.tar.gz
Diffstat (limited to 't/cmop/anon_class_leak.t')
-rw-r--r--t/cmop/anon_class_leak.t26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/cmop/anon_class_leak.t b/t/cmop/anon_class_leak.t
new file mode 100644
index 0000000..0a292fc
--- /dev/null
+++ b/t/cmop/anon_class_leak.t
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Requires 'Test::LeakTrace'; # skip all if not installed
+
+BEGIN {
+ plan skip_all => 'Leak tests fail under Devel::Cover' if $INC{'Devel/Cover.pm'};
+}
+
+use Class::MOP;
+
+# 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 => [...])';
+
+done_testing;