5 use Test::More tests => 14;
11 use MooseX::Types::Common (
12 qw(SimpleStr NonEmptySimpleStr Password StrongPassword NonEmptyStr),
15 has simplestr => ( is => 'rw', isa => SimpleStr);
16 has nestr => ( is => 'rw', isa => NonEmptyStr);
17 has nesimplestr => ( is => 'rw', isa => NonEmptySimpleStr);
18 has password => ( is => 'rw', isa => Password);
19 has strongpassword => ( is => 'rw', isa => StrongPassword);
22 my $ins = FooTest->new;
24 lives_ok { $ins->simplestr('') } 'SimpleStr';
25 lives_ok { $ins->simplestr('good string') } 'SimpleStr 2';
26 dies_ok { $ins->simplestr("bad\nstring") } 'SimpleStr 3';
27 dies_ok { $ins->simplestr(join('', ("long string" x 25))) } 'SimpleStr 4';
29 dies_ok { $ins->nestr('') } 'NonEmptyStr';
30 lives_ok { $ins->nestr('good string') } 'NonEmptyStr 2';
31 lives_ok { $ins->nestr("bad\nstring") } 'NonEmptyStr 3';
32 lives_ok { $ins->nestr(join('', ("long string" x 25))) } 'NonEmptyStr 4';
34 lives_ok { $ins->nesimplestr('good str') } 'NonEmptySimplrStr ';
35 dies_ok { $ins->nesimplestr('') } 'NonEmptyStr 2';
37 dies_ok { $ins->password('no') } 'Password';
38 lives_ok { $ins->password('okay') } 'Password 2';
40 dies_ok { $ins->strongpassword('notokay') } 'StrongPassword';
41 lives_ok { $ins->strongpassword('83773r_ch01c3') } 'StrongPassword 2';