4 use Test::More tests => 7;
7 use Mouse::Util::TypeConstraints;
12 use Mouse::Util::TypeConstraints;
16 => where { length $_ }
17 => message { "The string is empty!" };
25 ok(My::Class->new(name => 'foo'));
27 throws_ok { My::Class->new(name => '') } qr/^Attribute \(name\) does not pass the type constraint because: The string is empty!/;
29 my $st = subtype as 'Str', where{ length };
31 ok $st->is_a_type_of('Str');
32 ok!$st->is_a_type_of('NoemptyStr');