summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-04-11 17:24:44 -0500
committerdoy <doy@tozt.net>2009-04-11 17:24:44 -0500
commit3eb2caa01ccada44a35efea3f80d5a7254b1ef8d (patch)
treebe9887845f1b208414420aedf7c9bc42681d26b7 /t
parent0fe734746f6a61577b1dc75df6d264c695e04be4 (diff)
downloadmoosex-nonmoose-3eb2caa01ccada44a35efea3f80d5a7254b1ef8d.tar.gz
moosex-nonmoose-3eb2caa01ccada44a35efea3f80d5a7254b1ef8d.zip
add more tests for inheriting from moose classes
Diffstat (limited to 't')
-rw-r--r--t/005-moose.t31
1 files changed, 28 insertions, 3 deletions
diff --git a/t/005-moose.t b/t/005-moose.t
index 59a0106..86578cb 100644
--- a/t/005-moose.t
+++ b/t/005-moose.t
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 14;
package Foo;
use Moose;
@@ -27,6 +27,31 @@ $_->meta->make_immutable for qw(Foo Foo::Sub);
$foo_sub = Foo::Sub->new;
isa_ok $foo_sub, 'Foo';
-is $foo_sub->foo, 'FOO', 'inheritance works';
+is $foo_sub->foo, 'FOO', 'inheritance works (immutable)';
is(Foo::Sub->meta->get_method('new'), undef,
- 'Foo::Sub doesn\'t have its own new method');
+ 'Foo::Sub doesn\'t have its own new method (immutable)');
+
+package Foo::OtherSub;
+use Moose;
+use MooseX::NonMoose;
+extends 'Foo';
+
+package main;
+my $foo_othersub = Foo::OtherSub->new;
+isa_ok $foo_othersub, 'Foo';
+is $foo_othersub->foo, 'FOO', 'inheritance works (immutable when extending)';
+ok(Foo::OtherSub->meta->get_method('new'),
+ 'Foo::OtherSub has its own inlined constructor (immutable when extending)');
+ok(!(Foo::OtherSub->meta->get_method('new')->can('does_role')
+ && Foo::OtherSub->meta->get_method('new')->does_role('MooseX::NonMoose::Meta::Role::Constructor')),
+ 'Foo::OtherSub\'s inlined constructor is from Moose, not MooseX::NonMoose (immutable when extending)');
+
+Foo::OtherSub->meta->make_immutable;
+$foo_othersub = Foo::OtherSub->new;
+isa_ok $foo_othersub, 'Foo';
+is $foo_othersub->foo, 'FOO', 'inheritance works (all immutable)';
+ok(Foo::OtherSub->meta->get_method('new'),
+ 'Foo::OtherSub has its own inlined constructor (immutable when extending)');
+ok(!(Foo::OtherSub->meta->get_method('new')->can('does_role')
+ && Foo::OtherSub->meta->get_method('new')->does_role('MooseX::NonMoose::Meta::Role::Constructor')),
+ 'Foo::OtherSub\'s inlined constructor is from Moose, not MooseX::NonMoose (immutable when extending)');