Add all my tests wrt use base
Tomas Doran (t0m) [Mon, 20 Apr 2009 22:08:11 +0000 (23:08 +0100)]
t/600_todo_tests/006_moose_nonmoose_nonmoose_chain_metatrait_init_order.t [new file with mode: 0644]
t/600_todo_tests/007_moose_nonmoose_moose_chain_init_meta.t [new file with mode: 0644]
t/600_todo_tests/008_moose_nonmoose_moose_chain_extends.t [new file with mode: 0644]

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 (file)
index 0000000..2c8bfe5
--- /dev/null
@@ -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 (file)
index 0000000..86dfa15
--- /dev/null
@@ -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 (file)
index 0000000..5aef147
--- /dev/null
@@ -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';
+}
+