From: Dave Rolsky Date: Sun, 14 Sep 2008 21:47:25 +0000 (+0000) Subject: More code tidying X-Git-Tag: 0.58~37^2~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c897bc79516000d50edcc596a8bb741385c7802c;p=gitmo%2FMoose.git More code tidying --- diff --git a/t/040_type_constraints/027_parameterize_from.t b/t/040_type_constraints/027_parameterize_from.t index 31d301f..f917e28 100644 --- a/t/040_type_constraints/027_parameterize_from.t +++ b/t/040_type_constraints/027_parameterize_from.t @@ -13,68 +13,67 @@ BEGIN { # testing the parameterize method { - my $parameterizable = subtype 'parameterizable_hashref', - as 'HashRef'; - - my $parameterized = subtype 'parameterized_hashref', - as 'HashRef[Int]'; - - my $int = Moose::Util::TypeConstraints::find_type_constraint('Int'); - - my $from_parameterizable = $parameterizable->parameterize($int); - - isa_ok $parameterizable, 'Moose::Meta::TypeConstraint::Parameterizable', - => 'Got expected type instance'; - - package Test::Moose::Meta::TypeConstraint::Parameterizable; - use Moose; - - has parameterizable => (is=>'rw', isa=>$parameterizable); - has parameterized => (is=>'rw', isa=>$parameterized); - has from_parameterizable => (is=>'rw', isa=>$from_parameterizable); + my $parameterizable = subtype 'parameterizable_hashref', as 'HashRef'; + + my $parameterized = subtype 'parameterized_hashref', as 'HashRef[Int]'; + + my $int = Moose::Util::TypeConstraints::find_type_constraint('Int'); + + my $from_parameterizable = $parameterizable->parameterize($int); + + isa_ok $parameterizable, + 'Moose::Meta::TypeConstraint::Parameterizable', => + 'Got expected type instance'; + + package Test::Moose::Meta::TypeConstraint::Parameterizable; + use Moose; + + has parameterizable => ( is => 'rw', isa => $parameterizable ); + has parameterized => ( is => 'rw', isa => $parameterized ); + has from_parameterizable => ( is => 'rw', isa => $from_parameterizable ); } # Create and check a dummy object -ok my $params = Test::Moose::Meta::TypeConstraint::Parameterizable->new() - => 'Create Dummy object for testing'; - -isa_ok $params, 'Test::Moose::Meta::TypeConstraint::Parameterizable' - => 'isa correct type'; +ok my $params = Test::Moose::Meta::TypeConstraint::Parameterizable->new() => + 'Create Dummy object for testing'; + +isa_ok $params, 'Test::Moose::Meta::TypeConstraint::Parameterizable' => + 'isa correct type'; # test parameterizable lives_ok sub { - $params->parameterizable({a=>'Hello', b=>'World'}); + $params->parameterizable( { a => 'Hello', b => 'World' } ); } => 'No problem setting parameterizable'; -is_deeply $params->parameterizable, {a=>'Hello', b=>'World'} - => 'Got expected values'; +is_deeply $params->parameterizable, + { a => 'Hello', b => 'World' } => 'Got expected values'; # test parameterized lives_ok sub { - $params->parameterized({a=>1, b=>2}); + $params->parameterized( { a => 1, b => 2 } ); } => 'No problem setting parameterized'; -is_deeply $params->parameterized, {a=>1, b=>2} - => 'Got expected values'; - +is_deeply $params->parameterized, { a => 1, b => 2 } => 'Got expected values'; + throws_ok sub { - $params->parameterized({a=>'Hello', b=>'World'}); -}, qr/Attribute \(parameterized\) does not pass the type constraint/ - => 'parameterized throws expected error'; + $params->parameterized( { a => 'Hello', b => 'World' } ); + }, qr/Attribute \(parameterized\) does not pass the type constraint/ => + 'parameterized throws expected error'; # test from_parameterizable lives_ok sub { - $params->from_parameterizable({a=>1, b=>2}); + $params->from_parameterizable( { a => 1, b => 2 } ); } => 'No problem setting from_parameterizable'; -is_deeply $params->from_parameterizable, {a=>1, b=>2} - => 'Got expected values'; - +is_deeply $params->from_parameterizable, + { a => 1, b => 2 } => 'Got expected values'; + throws_ok sub { - $params->from_parameterizable({a=>'Hello', b=>'World'}); -}, qr/Attribute \(from_parameterizable\) does not pass the type constraint/ - => 'from_parameterizable throws expected error'; + $params->from_parameterizable( { a => 'Hello', b => 'World' } ); + }, + qr/Attribute \(from_parameterizable\) does not pass the type constraint/ + => 'from_parameterizable throws expected error';