From: Jesse Luehrs Date: Sat, 30 May 2009 04:17:46 +0000 (-0500) Subject: add todo test for immutable metaclasses with traits X-Git-Tag: 0.80~60 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a886a4d6f17e7c334a962c0a61f6ecad80ed66ff;p=gitmo%2FMoose.git add todo test for immutable metaclasses with traits --- diff --git a/t/300_immutable/014_immutable_metaclass_with_traits.t b/t/300_immutable/014_immutable_metaclass_with_traits.t new file mode 100644 index 0000000..e3b68b2 --- /dev/null +++ b/t/300_immutable/014_immutable_metaclass_with_traits.t @@ -0,0 +1,34 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 10; + +{ + package FooTrait; + use Moose::Role; +} +{ + package Foo; + use Moose -traits => ['FooTrait']; +} + +is(Class::MOP::class_of('Foo'), Foo->meta, + "class_of and ->meta are the same on Foo"); +my $meta = Foo->meta; +is(Class::MOP::class_of($meta), $meta->meta, + "class_of and ->meta are the same on Foo's metaclass"); +isa_ok(Class::MOP::class_of($meta), 'Moose::Meta::Class'); +isa_ok($meta->meta, 'Moose::Meta::Class'); +Foo->meta->make_immutable; +is(Class::MOP::class_of('Foo'), Foo->meta, + "class_of and ->meta are the same on Foo (immutable)"); +$meta = Foo->meta; +isa_ok($meta->meta, 'Moose::Meta::Class'); +ok(Class::MOP::class_of($meta)->is_immutable, "metaclass is immutable"); +TODO: { + local $TODO = "immutable metaclasses with traits do weird things"; + is(Class::MOP::class_of($meta), $meta->meta, + "class_of and ->meta are the same on Foo's metaclass (immutable)"); + isa_ok(Class::MOP::class_of($meta), 'Moose::Meta::Class'); + ok($meta->meta->is_immutable, "metaclass is immutable"); +}