diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-06 17:50:16 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-06 17:50:16 +0000 |
commit | 5ac2026f7eed78958d69d051e7a8e993dcf51205 (patch) | |
tree | 298c3d2f08bdfe5689998b11892d72a897985be1 /t/cmop/anon_class_removal.t | |
download | Moose-tarball-master.tar.gz |
Moose-2.1405HEADMoose-2.1405master
Diffstat (limited to 't/cmop/anon_class_removal.t')
-rw-r--r-- | t/cmop/anon_class_removal.t | 40 |
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; |