fix for prototype undecl issue when type constraint utils loaded before consumers...
[gitmo/Moose.git] / t / 022_moose_respects_base.t
index 5c96175..c967c22 100644 (file)
@@ -3,13 +3,24 @@
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 7;
 use Test::Exception;
 
 BEGIN {
     use_ok('Moose');           
 }
 
+=pod
+
+This test demonstrates that Moose will respect 
+a previously set @ISA using use base, and not 
+try to add Moose::Object to it. 
+
+However, this is extremely order sensitive as 
+this test also demonstrates.
+
+=cut
+
 {
     package Foo;
     use strict;
@@ -17,14 +28,24 @@ BEGIN {
     
     sub foo { 'Foo::foo' }
     
-    package Bar;
-    use strict;
-    use warnings;
+    package Bar;    
+    use base 'Foo';
     use Moose;
     
-    use base 'Foo';
+    sub new { (shift)->meta->new_object(@_) }    
+    
+    package Baz;
+    use Moose;    
+    use base 'Foo'; 
 }
 
 my $bar = Bar->new;
 isa_ok($bar, 'Bar');
-isa_ok($bar, 'Foo');
\ No newline at end of file
+isa_ok($bar, 'Foo');
+ok(!$bar->isa('Moose::Object'), '... Bar is not Moose::Object subclass');
+
+my $baz = Baz->new;
+isa_ok($baz, 'Baz');
+isa_ok($baz, 'Foo');
+isa_ok($baz, 'Moose::Object');
+