From: Shawn M Moore Date: Mon, 22 Dec 2008 02:40:16 +0000 (+0000) Subject: More uses of type in the tests X-Git-Tag: 0.19~96 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3fa6f35df998618abdf763f4e4a060ba8f450a35;p=gitmo%2FMouse.git More uses of type in the tests --- diff --git a/t/800_shikabased/002-coerce_multi_class.t b/t/800_shikabased/002-coerce_multi_class.t index 2bfd2d2..87450fe 100644 --- a/t/800_shikabased/002-coerce_multi_class.t +++ b/t/800_shikabased/002-coerce_multi_class.t @@ -18,7 +18,7 @@ use Test::More tests => 14; use Mouse; use Mouse::Util::TypeConstraints; - subtype 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } }; + type 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } }; coerce 'Headers' => from 'HashRef' => via { Response::Headers->new(%{ $_ }); @@ -36,7 +36,7 @@ eval { package Request; use Mouse::Util::TypeConstraints; - subtype 'Headers' => where { defined $_ && eval { $_->isa('Request::Headers') } }; + type 'Headers' => where { defined $_ && eval { $_->isa('Request::Headers') } }; }; like $@, qr/The type constraint 'Headers' has already been created, cannot be created again in Request/; @@ -90,7 +90,7 @@ ok !$@; eval { package Response; - subtype 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } }; + type 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } }; }; like $@, qr/The type constraint 'Headers' has already been created, cannot be created again in Response/; diff --git a/t/800_shikabased/009-overwrite-builtin-subtype.t b/t/800_shikabased/009-overwrite-builtin-subtype.t index 659a1a6..d927a3f 100644 --- a/t/800_shikabased/009-overwrite-builtin-subtype.t +++ b/t/800_shikabased/009-overwrite-builtin-subtype.t @@ -6,6 +6,6 @@ eval { package Request; use Mouse::Util::TypeConstraints; - subtype 'Int' => where { 1}; + type 'Int' => where { 1}; }; like $@, qr/The type constraint 'Int' has already been created, cannot be created again in Request/; diff --git a/t/800_shikabased/010-isa-or.t b/t/800_shikabased/010-isa-or.t index 8b45921..0991ab7 100644 --- a/t/800_shikabased/010-isa-or.t +++ b/t/800_shikabased/010-isa-or.t @@ -6,7 +6,7 @@ use Test::More tests => 18; package Foo; use Mouse; use Mouse::Util::TypeConstraints; - subtype Baz => where { defined($_) && $_ eq 'Baz' }; + type Baz => where { defined($_) && $_ eq 'Baz' }; coerce Baz => from 'ArrayRef', via { 'Baz' }; has 'bar' => ( is => 'rw', isa => 'Str | Baz | Undef', coerce => 1 ); } @@ -53,10 +53,10 @@ is $f->bar, undef, 'bar is undef'; use Mouse; use Mouse::Util::TypeConstraints; - subtype 'Type1' => where { defined($_) && $_ eq 'Name' }; + type 'Type1' => where { defined($_) && $_ eq 'Name' }; coerce 'Type1', from 'Str', via { 'Names' }; - subtype 'Type2' => where { defined($_) && $_ eq 'Group' }; + type 'Type2' => where { defined($_) && $_ eq 'Group' }; coerce 'Type2', from 'Str', via { 'Name' }; has 'foo' => ( is => 'rw', isa => 'Type1|Type2', coerce => 1 ); @@ -76,7 +76,7 @@ is $foo->foo, 'Name', 'foo is Name'; use Mouse; use Mouse::Util::TypeConstraints; - subtype 'Type3' => where { defined($_) && $_ eq 'Name' }; + type 'Type3' => where { defined($_) && $_ eq 'Name' }; coerce 'Type3', from 'CodeRef', via { 'Name' }; has 'foo' => ( is => 'rw', isa => 'Type3|KLASS|Undef', coerce => 1 ); diff --git a/t/800_shikabased/014-subtype-as.t b/t/800_shikabased/014-subtype-as.t index 263e5ac..0a95057 100644 --- a/t/800_shikabased/014-subtype-as.t +++ b/t/800_shikabased/014-subtype-as.t @@ -37,7 +37,7 @@ use Scalar::Util qw/blessed/; ); - subtype 'Type4'; + type 'Type4'; has any => ( is => 'rw', isa => 'Type4', diff --git a/t/800_shikabased/801-mousex_types.t b/t/800_shikabased/801-mousex_types.t index e0eaca5..1b82811 100644 --- a/t/800_shikabased/801-mousex_types.t +++ b/t/800_shikabased/801-mousex_types.t @@ -7,7 +7,7 @@ use Test::More tests => 16; use MouseX::Types -declare => [qw/ Headers /]; use MouseX::Types::Mouse 'HashRef'; - subtype Headers, where { defined $_ && eval { $_->isa('Headers1') } }; + type Headers, where { defined $_ && eval { $_->isa('Headers1') } }; coerce Headers, from HashRef, via { Headers1->new(%{ $_ }); @@ -20,7 +20,7 @@ use Test::More tests => 16; use MouseX::Types -declare => [qw/ Headers /]; use MouseX::Types::Mouse 'HashRef'; - subtype Headers, where { defined $_ && eval { $_->isa('Headers2') } }; + type Headers, where { defined $_ && eval { $_->isa('Headers2') } }; coerce Headers, from HashRef, via { Headers2->new(%{ $_ }); diff --git a/t/800_shikabased/802-mousex_types-isa-or.t b/t/800_shikabased/802-mousex_types-isa-or.t index bd20f3a..693b9a1 100644 --- a/t/800_shikabased/802-mousex_types-isa-or.t +++ b/t/800_shikabased/802-mousex_types-isa-or.t @@ -9,13 +9,13 @@ use Test::More tests => 13; use MouseX::Types -declare => [qw/ Baz Type1 Type2 /]; use MouseX::Types::Mouse qw( ArrayRef ); - subtype Baz, where { defined($_) && $_ eq 'Baz' }; + type Baz, where { defined($_) && $_ eq 'Baz' }; coerce Baz, from ArrayRef, via { 'Baz' }; - subtype Type1, where { defined($_) && $_ eq 'Name' }; + type Type1, where { defined($_) && $_ eq 'Name' }; coerce Type1, from 'Str', via { 'Names' }; - subtype Type2, where { defined($_) && $_ eq 'Group' }; + type Type2, where { defined($_) && $_ eq 'Group' }; coerce Type2, from 'Str', via { 'Name' }; }