From: gfx Date: Fri, 9 Oct 2009 04:37:08 +0000 (+0900) Subject: Add test to make anonymous classes immutable X-Git-Tag: 0.37_05~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=6cc6c673f9175314c395c60b894322e6f584d963 Add test to make anonymous classes immutable --- diff --git a/t/800_shikabased/008-create_class.t b/t/800_shikabased/008-create_class.t index 76e5bcb..4c80122 100644 --- a/t/800_shikabased/008-create_class.t +++ b/t/800_shikabased/008-create_class.t @@ -1,7 +1,7 @@ use strict; use warnings; use Mouse (); -use Test::More tests => 19; +use Test::More tests => 23; use Test::Exception; # error handling @@ -83,3 +83,16 @@ ok !$anon_pkg1->can('meta'); ok $anon_pkg2->can('meta'), 'cache => 1 makes it immortal'; +my $obj; +{ + my $anon = Mouse::Meta::Class->create_anon_class(superclasses => ['Mouse::Object']); + lives_ok{ $anon->make_immutable() } 'make anon class immutable'; + $obj = $anon->name->new(); +} + +isa_ok $obj, 'Mouse::Object'; +can_ok $obj, 'meta'; +lives_and{ + isa_ok $obj->meta, 'Mouse::Meta::Class'; +}; +