summaryrefslogtreecommitdiff
path: root/t/cmop/anon_class_removal.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_removal.t
downloadMoose-tarball-master.tar.gz
Diffstat (limited to 't/cmop/anon_class_removal.t')
-rw-r--r--t/cmop/anon_class_removal.t40
1 files changed, 40 insertions, 0 deletions
diff --git a/t/cmop/anon_class_removal.t b/t/cmop/anon_class_removal.t
new file mode 100644
index 0000000..9d0313a
--- /dev/null
+++ b/t/cmop/anon_class_removal.t
@@ -0,0 +1,40 @@
+use strict;
+use warnings;
+use Test::More;
+
+use Class::MOP;
+
+{
+ my $class;
+ {
+ my $meta = Class::MOP::Class->create_anon_class(
+ methods => {
+ foo => sub { 'FOO' },
+ },
+ );
+
+ $class = $meta->name;
+ can_ok($class, 'foo');
+ is($class->foo, 'FOO');
+ }
+ ok(!$class->can('foo'));
+}
+
+{
+ my $class;
+ {
+ my $meta = Class::MOP::Class->create_anon_class(
+ methods => {
+ foo => sub { 'FOO' },
+ },
+ );
+
+ $class = $meta->name;
+ can_ok($class, 'foo');
+ is($class->foo, 'FOO');
+ Class::MOP::remove_metaclass_by_name($class);
+ }
+ ok(!$class->can('foo'));
+}
+
+done_testing;