X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F01-string.t;h=d29ef2b69252b3c91e4225f1e6c4b1833c0cdc7a;hb=559b5d74cde30be92fb26402bf2bc7e69fab16df;hp=611a84afffa7b9f1f47b5d0d6ec9a4c615d3d823;hpb=a40ef11aad38121a0e17c5ea693e10b72d9218f7;p=gitmo%2FMooseX-Types-Common.git diff --git a/t/01-string.t b/t/01-string.t index 611a84a..d29ef2b 100644 --- a/t/01-string.t +++ b/t/01-string.t @@ -2,8 +2,9 @@ use strict; use warnings; -use Test::More tests => 22; +use Test::More tests => 25; use Test::Fatal; +use Test::Exception; { package FooTest; @@ -17,7 +18,9 @@ use Test::Fatal; StrongPassword NonEmptyStr LowerCaseStr - UpperCaseStr), + UpperCaseStr + NumericCode + ), ); has simplestr => ( is => 'rw', isa => SimpleStr ); @@ -29,6 +32,7 @@ use Test::Fatal; has strongpassword => ( is => 'rw', isa => StrongPassword ); has lowercasestr => ( is => 'rw', isa => LowerCaseStr ); has uppercasestr => ( is => 'rw', isa => UpperCaseStr ); + has numericcode => ( is => 'rw', isa => NumericCode ); } my $ins = FooTest->new; @@ -63,3 +67,8 @@ is(exception { $ins->lowercasestr('ok') }, undef, 'LowerCaseStr 2'); isnt(exception { $ins->uppercasestr('notok') }, undef, 'UpperCaseStr'); is(exception { $ins->uppercasestr('OK') }, undef, 'UpperCaseStr 2'); + + +is( exception { $ins->numericcode('032') }, undef, 'NumericCode lives'); +isnt( exception { $ins->numericcode('abc') }, undef, 'NumericCode dies' ); +isnt( exception { $ins->numericcode('x18') }, undef, 'mixed NumericCode dies');