X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F300_immutable%2F009_buildargs.t;h=f2959a9068708ac38289a7a572485dfc060e4671;hb=a1a2469a369e71a583eb55e09c5b989d77031e39;hp=5f9a10adecd0fb62b2271749f668088246b64a78;hpb=9dcd7d2378107301c0f815a407b3b4e55c2909f8;p=gitmo%2FMouse.git diff --git a/t/300_immutable/009_buildargs.t b/t/300_immutable/009_buildargs.t index 5f9a10a..f2959a9 100644 --- a/t/300_immutable/009_buildargs.t +++ b/t/300_immutable/009_buildargs.t @@ -1,16 +1,19 @@ #!/usr/bin/perl +# This is automatically generated by author/import-moose-test.pl. +# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! +use t::lib::MooseCompat; use strict; use warnings; -use Test::More tests => 14; +use Test::More; { package Foo; use Mouse; has bar => ( is => "rw" ); - has baz => ( is => "rw" ); + has baz => ( is => "rw" ); sub BUILDARGS { my ( $self, @args ) = @_; @@ -24,20 +27,24 @@ use Test::More tests => 14; use Mouse; extends qw(Foo); - + __PACKAGE__->meta->make_immutable; } -foreach my $class qw(Foo Bar) { +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 $ob = $class->new(42, baz => 47); - is($ob->bar, 42, '... got the right bar'); - is($ob->baz, 47, '... got the right bar'); + { + 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;