From: Jesse Luehrs Date: Sat, 6 Feb 2010 21:38:27 +0000 (-0600) Subject: add tests for nonmoose classes getting a moose metaclass X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3851521641615673455029c551bf69f901cae72;p=gitmo%2FMoose.git add tests for nonmoose classes getting a moose metaclass --- diff --git a/t/600_todo_tests/006_nonmoose_moose_metaclass.t b/t/600_todo_tests/006_nonmoose_moose_metaclass.t new file mode 100644 index 0000000..040ac23 --- /dev/null +++ b/t/600_todo_tests/006_nonmoose_moose_metaclass.t @@ -0,0 +1,52 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +# this case started breaking in 0.92 +{ + package Foo; + sub new { bless {}, shift } +} + +{ + package Foo::Meta::Trait; + use Moose::Role; +} + +{ + package Foo::Moose; + use Moose -traits => [qw(Foo::Meta::Trait)]; + extends 'Foo'; +} + +ok(!Class::MOP::Class->initialize('Foo')->isa('Moose::Meta::Class'), + "we don't get a moose metaclass for nonmoose classes"); + +# this case was broken before 0.90, not sure if it ever worked properly +{ + package Bar; + sub new { bless {}, shift } +} + +{ + package Bar::Sub; + use base 'Bar'; +} + +{ + package Bar::Meta::Trait; + use Moose::Role; +} + +{ + package Bar::Moose; + use Moose -traits => [qw(Bar::Meta::Trait)]; + extends 'Bar::Sub'; + __PACKAGE__->meta->make_immutable(inline_constructor => 0); +} + +ok(!Class::MOP::Class->initialize('Bar')->isa('Moose::Meta::Class'), + "we don't get a moose metaclass for nonmoose classes"); + +done_testing;