X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F010_basics%2F011_moose_respects_type_constraints.t;h=3e0997aa71c21cda4660d16c1f118285d939359e;hb=efa806d8d67ff765a3d5e20dadbe31f7a2dfcc0c;hp=a62f14722583daced5334353f5b4f9731cac9118;hpb=7ff5653479c2bfc0794635f7fbade9bfe7bb2381;p=gitmo%2FMoose.git diff --git a/t/010_basics/011_moose_respects_type_constraints.t b/t/010_basics/011_moose_respects_type_constraints.t index a62f147..3e0997a 100644 --- a/t/010_basics/011_moose_respects_type_constraints.t +++ b/t/010_basics/011_moose_respects_type_constraints.t @@ -3,27 +3,27 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More; use Test::Exception; use Moose::Util::TypeConstraints; =pod -This tests demonstrates that Moose will not override -a pre-existing type constraint of the same name when +This tests demonstrates that Moose will not override +a preexisting type constraint of the same name when making constraints for a Moose-class. It also tests that an attribute which uses a 'Foo' for -it's isa option will get the subtype Foo, and not a +it's isa option will get the subtype Foo, and not a type representing the Foo moose class. =cut -BEGIN { +BEGIN { # create this subtype first (in BEGIN) - subtype Foo - => as 'Value' + subtype Foo + => as 'Value' => where { $_ eq 'Foo' }; } @@ -43,7 +43,7 @@ ok(!$foo_constraint->check('Bar'), '... my constraint failed correctly'); { package Bar; use Moose; - + has 'foo' => (is => 'rw', isa => 'Foo'); } @@ -51,12 +51,11 @@ my $bar = Bar->new; isa_ok($bar, 'Bar'); lives_ok { - $bar->foo('Foo'); + $bar->foo('Foo'); } '... checked the type constraint correctly'; dies_ok { - $bar->foo(Foo->new); + $bar->foo(Foo->new); } '... checked the type constraint correctly'; - - +done_testing;