some changes, seee changes for details
[gitmo/Moose.git] / t / 300_immutable / 009_buildargs.t
index e1a3016..6c1ca33 100644 (file)
@@ -3,13 +3,14 @@
 use strict;
 use warnings;
 
-use Test::More 'no_plan';
+use Test::More tests => 14;
 
 {
     package Foo;
     use Moose;
 
     has bar => ( is => "rw" );
+    has baz => ( is => "rw" );    
 
     sub BUILDARGS {
         my ( $self, @args ) = @_;
@@ -17,11 +18,13 @@ use Test::More 'no_plan';
         return {@args};
     }
 
+    __PACKAGE__->meta->make_immutable;
+
     package Bar;
     use Moose;
 
     extends qw(Foo);
-
+    
     __PACKAGE__->meta->make_immutable;
 }
 
@@ -29,4 +32,16 @@ foreach my $class qw(Foo Bar) {
     is( $class->new->bar, undef, "no args" );
     is( $class->new( bar => 42 )->bar, 42, "normal args" );
     is( $class->new( 37 )->bar, 37, "single arg" );
+    {
+        my $o = $class->new(bar => 42, baz => 47);
+        is($o->bar, 42, '... got the right bar');
+        is($o->baz, 47, '... got the right bar');
+    }
+    {
+        my $o = $class->new(42, baz => 47);
+        is($o->bar, 42, '... got the right bar');
+        is($o->baz, 47, '... got the right bar');
+    }    
 }
+
+