From: Tomas Doran (t0m) Date: Mon, 20 Apr 2009 22:08:11 +0000 (+0100) Subject: Add all my tests wrt use base X-Git-Tag: 0.75_01~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f2391d17574eff81d911b97be15ea51080500003;p=gitmo%2FMoose.git Add all my tests wrt use base --- diff --git a/t/600_todo_tests/006_moose_nonmoose_nonmoose_chain_metatrait_init_order.t b/t/600_todo_tests/006_moose_nonmoose_nonmoose_chain_metatrait_init_order.t new file mode 100644 index 0000000..2c8bfe5 --- /dev/null +++ b/t/600_todo_tests/006_moose_nonmoose_nonmoose_chain_metatrait_init_order.t @@ -0,0 +1,29 @@ +use strict; +use warnings; +{ + package My::Role; + use Moose::Role; +} +{ + package SomeClass; + use Moose -traits => 'My::Role'; +} +{ + package SubClassUseBase; + use base qw/SomeClass/; +} +{ + package SubSubClassUseBase; + use base qw/SubClassUseBase/; +} + +use Test::More tests => 2; +use Moose::Util qw/find_meta does_role/; + +my $subsubclass_meta = Moose->init_meta( for_class => 'SubSubClassUseBase' ); +ok does_role($subsubclass_meta, 'My::Role'), + 'SubSubClass metaclass does role from grandparent metaclass'; +my $subclass_meta = find_meta('SubClassUseBase'); +ok does_role($subclass_meta, 'My::Role'), + 'SubClass metaclass does role from parent metaclass'; + diff --git a/t/600_todo_tests/007_moose_nonmoose_moose_chain_init_meta.t b/t/600_todo_tests/007_moose_nonmoose_moose_chain_init_meta.t new file mode 100644 index 0000000..86dfa15 --- /dev/null +++ b/t/600_todo_tests/007_moose_nonmoose_moose_chain_init_meta.t @@ -0,0 +1,23 @@ +use strict; +use warnings; +{ + package ParentClass; + use Moose; +} +{ + package SomeClass; + use base 'ParentClass'; +} +{ + package SubClassUseBase; + use base qw/SomeClass/; + use Moose; +} + +use Test::More tests => 1; +use Test::Exception; + +lives_ok { + Moose->init_meta(for_class => 'SomeClass'); +} 'Moose class => use base => Moose Class, then Moose->init_meta on middle class ok'; + diff --git a/t/600_todo_tests/008_moose_nonmoose_moose_chain_extends.t b/t/600_todo_tests/008_moose_nonmoose_moose_chain_extends.t new file mode 100644 index 0000000..5aef147 --- /dev/null +++ b/t/600_todo_tests/008_moose_nonmoose_moose_chain_extends.t @@ -0,0 +1,25 @@ +use strict; +use warnings; +use Test::More tests => 1; + +{ + package My::Role; + use Moose::Role; +} +{ + package SomeClass; + use Moose -traits => 'My::Role'; +} +{ + package SubClassUseBase; + use base qw/SomeClass/; +} +{ + package SubSubClassUseBase; + use Moose; + use Test::Exception; + lives_ok { + extends 'SubClassUseBase'; + } 'Can extend non-moose class whos parent class is a Moose class with a meta role'; +} +