X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F300_immutable%2F009_buildargs.t;h=283ed5c739fb381bb91a138db1375e82ca65c28d;hb=ea829e77f657851c78cd65dd2b7ed05ce6c6ffff;hp=e1a301699014428b14bd23093763799899998e1f;hpb=a136705d777111a3b66bef78b3a026049e68d9eb;p=gitmo%2FMoose.git diff --git a/t/300_immutable/009_buildargs.t b/t/300_immutable/009_buildargs.t index e1a3016..283ed5c 100644 --- a/t/300_immutable/009_buildargs.t +++ b/t/300_immutable/009_buildargs.t @@ -3,13 +3,14 @@ use strict; use warnings; -use Test::More 'no_plan'; +use Test::More; { package Foo; use Moose; has bar => ( is => "rw" ); + has baz => ( is => "rw" ); sub BUILDARGS { my ( $self, @args ) = @_; @@ -17,6 +18,8 @@ use Test::More 'no_plan'; return {@args}; } + __PACKAGE__->meta->make_immutable; + package Bar; use Moose; @@ -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'); + } } + +done_testing;