From: gfx Date: Sun, 28 Feb 2010 07:26:47 +0000 (+0900) Subject: Add a todo to test metaclass compatibility X-Git-Tag: 0.50_05~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7324ed54dd088d42fb677a55093d3c23775418da;p=gitmo%2FMouse.git Add a todo to test metaclass compatibility --- diff --git a/t/001_mouse/067-traits.t b/t/001_mouse/067-traits.t index 97c79e8..dbbea5e 100644 --- a/t/001_mouse/067-traits.t +++ b/t/001_mouse/067-traits.t @@ -6,17 +6,31 @@ use Test::More; use Test::Mouse qw(does_ok); -BEGIN{ +BEGIN{ $SIG{__WARN__} = \&Carp::confess } + +BEGIN { package MyMouseX::Foo::Method; use Mouse::Role; - sub foo {} + sub foo_method {} + + package MyMouseX::Foo::Class; + use Mouse::Role; + + sub foo_class {} package MyMouseX::Bar::Method; use Mouse::Role; sub bar {} + package MyMouseX::Bar::Class; + use Mouse::Role; + + sub bar_class {} +} + +BEGIN { package MyMouseX::Foo; use Mouse::Exporter; use Mouse::Util::MetaRole; @@ -31,6 +45,7 @@ BEGIN{ Mouse::Util::MetaRole::apply_metaroles( for => $options{for_class}, class_metaroles => { + class => ['MyMouseX::Foo::Class'], method => ['MyMouseX::Foo::Method'], }, ); @@ -52,6 +67,7 @@ BEGIN{ Mouse::Util::MetaRole::apply_metaroles( for => $options{for_class}, class_metaroles => { + class => ['MyMouseX::Bar::Class'], method => ['MyMouseX::Bar::Method'], }, ); @@ -69,9 +85,31 @@ BEGIN{ use MyMouseX::Bar; sub b {} + + package ClassC; + use Mouse; + + #extends qw(ClassB ClassA); + extends qw(ClassA); + + sub c {} } +does_ok(ClassA->meta, 'MyMouseX::Foo::Class'); does_ok(ClassA->meta->get_method('a'), 'MyMouseX::Foo::Method'); + +does_ok(ClassB->meta, 'MyMouseX::Bar::Class'); does_ok(ClassB->meta->get_method('b'), 'MyMouseX::Bar::Method'); +# for ClassC + +does_ok(ClassC->meta, 'MyMouseX::Foo::Class'); + +{ + local $TODO = 'Metaclass incompatibility is not completed'; + does_ok(ClassC->meta->get_method('c'), 'MyMouseX::Foo::Method'); +} +#does_ok(ClassC->meta, 'MyMouseX::Bar::Class'); +#does_ok(ClassC->meta->get_method('c'), 'MyMouseX::Bar::Method'); + done_testing;