X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F039-subtype.t;fp=t%2F039-subtype.t;h=0000000000000000000000000000000000000000;hb=920139b3efca66d2caeeef306c97fa0da62c6b73;hp=755c40514101104e497176b18e63c72962797ba6;hpb=b644ef5d28f6076859080482d8b44727c1410e1c;p=gitmo%2FMouse.git diff --git a/t/039-subtype.t b/t/039-subtype.t deleted file mode 100644 index 755c405..0000000 --- a/t/039-subtype.t +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 7; -use Test::Exception; - -use Mouse::Util::TypeConstraints; - -do { - package My::Class; - use Mouse; - use Mouse::Util::TypeConstraints; - - subtype 'NonemptyStr' - => as 'Str' - => where { length $_ } - => message { "The string is empty!" }; - - has name => ( - is => 'ro', - isa => 'NonemptyStr', - ); -}; - -ok(My::Class->new(name => 'foo')); - -throws_ok { My::Class->new(name => '') } qr/^Attribute \(name\) does not pass the type constraint because: The string is empty!/; - -my $st = subtype as 'Str', where{ length }; - -ok $st->is_a_type_of('Str'); -ok!$st->is_a_type_of('NoemptyStr'); - -ok $st->check('Foo'); -ok!$st->check(undef); -ok!$st->check(''); -