X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F040_type_constraints%2F023_types_and_undef.t;h=1c2e7ee0a055e1cb59f26ee8c78a68f6b51d5131;hb=a28e50e44945358d15eb19e4688573741a319fe0;hp=f5eccd1c5f48214016e599b7a3855a8b7c01a2c5;hpb=c14746bc8269ab593798469dc204aa0d8f72f7ee;p=gitmo%2FMoose.git diff --git a/t/040_type_constraints/023_types_and_undef.t b/t/040_type_constraints/023_types_and_undef.t index f5eccd1..1c2e7ee 100644 --- a/t/040_type_constraints/023_types_and_undef.t +++ b/t/040_type_constraints/023_types_and_undef.t @@ -3,13 +3,9 @@ use strict; use warnings; -use Test::More tests => 55; +use Test::More; use Test::Exception; -BEGIN -{ - use_ok('Moose'); -} { package Foo; @@ -45,28 +41,28 @@ Moose::Util::TypeConstraints->export_type_constraints_as_functions; ok( Undef(undef), '... undef is a Undef'); ok(!Defined(undef), '... undef is NOT a Defined'); -ok(!Int(undef), '... undef is NOT a Int'); +ok(!Int(undef), '... undef is NOT an Int'); ok(!Number(undef), '... undef is NOT a Number'); ok(!Str(undef), '... undef is NOT a Str'); ok(!String(undef), '... undef is NOT a String'); - + ok(!Undef(5), '... 5 is a NOT a Undef'); ok(Defined(5), '... 5 is a Defined'); -ok(Int(5), '... 5 is a Int'); +ok(Int(5), '... 5 is an Int'); ok(Number(5), '... 5 is a Number'); -ok(Str(5), '... 5 is a Str'); +ok(Str(5), '... 5 is a Str'); ok(!String(5), '... 5 is NOT a String'); - + ok(!Undef(0.5), '... 0.5 is a NOT a Undef'); ok(Defined(0.5), '... 0.5 is a Defined'); -ok(!Int(0.5), '... 0.5 is NOT a Int'); +ok(!Int(0.5), '... 0.5 is NOT an Int'); ok(Number(0.5), '... 0.5 is a Number'); ok(Str(0.5), '... 0.5 is a Str'); ok(!String(0.5), '... 0.5 is NOT a String'); - + ok(!Undef('Foo'), '... "Foo" is NOT a Undef'); ok(Defined('Foo'), '... "Foo" is a Defined'); -ok(!Int('Foo'), '... "Foo" is NOT a Int'); +ok(!Int('Foo'), '... "Foo" is NOT an Int'); ok(!Number('Foo'), '... "Foo" is NOT a Number'); ok(Str('Foo'), '... "Foo" is a Str'); ok(String('Foo'), '... "Foo" is a String'); @@ -76,16 +72,16 @@ my $foo = Foo->new; lives_ok { $foo->vUndef(undef) } '... undef is a Foo->Undef'; dies_ok { $foo->vDefined(undef) } '... undef is NOT a Foo->Defined'; -dies_ok { $foo->vInt(undef) } '... undef is NOT a Foo->Int'; -dies_ok { $foo->vNumber(undef) } '... undef is NOT a Foo->Number'; -dies_ok { $foo->vStr(undef) } '... undef is NOT a Foo->Str'; -dies_ok { $foo->vString(undef) } '... undef is NOT a Foo->String'; +dies_ok { $foo->vInt(undef) } '... undef is NOT a Foo->Int'; +dies_ok { $foo->vNumber(undef) } '... undef is NOT a Foo->Number'; +dies_ok { $foo->vStr(undef) } '... undef is NOT a Foo->Str'; +dies_ok { $foo->vString(undef) } '... undef is NOT a Foo->String'; dies_ok { $foo->vUndef(5) } '... 5 is NOT a Foo->Undef'; lives_ok { $foo->vDefined(5) } '... 5 is a Foo->Defined'; lives_ok { $foo->vInt(5) } '... 5 is a Foo->Int'; lives_ok { $foo->vNumber(5) } '... 5 is a Foo->Number'; -lives_ok { $foo->vStr(5) } '... 5 is a Foo->Str'; +lives_ok { $foo->vStr(5) } '... 5 is a Foo->Str'; dies_ok { $foo->vString(5) } '... 5 is NOT a Foo->String'; dies_ok { $foo->vUndef(0.5) } '... 0.5 is NOT a Foo->Undef'; @@ -102,15 +98,13 @@ dies_ok { $foo->vNumber('Foo') } '... "Foo" is NOT a Foo->Number'; lives_ok { $foo->vStr('Foo') } '... "Foo" is a Foo->Str'; lives_ok { $foo->vString('Foo') } '... "Foo" is a Foo->String'; -# the lazy tests +# the lazy tests lives_ok { $foo->v_lazy_Undef() } '... undef is a Foo->Undef'; dies_ok { $foo->v_lazy_Defined() } '... undef is NOT a Foo->Defined'; -dies_ok { $foo->v_lazy_Int() } '... undef is NOT a Foo->Int'; -dies_ok { $foo->v_lazy_Number() } '... undef is NOT a Foo->Number'; -dies_ok { $foo->v_lazy_Str() } '... undef is NOT a Foo->Str'; -dies_ok { $foo->v_lazy_String() } '... undef is NOT a Foo->String'; - - - +dies_ok { $foo->v_lazy_Int() } '... undef is NOT a Foo->Int'; +dies_ok { $foo->v_lazy_Number() } '... undef is NOT a Foo->Number'; +dies_ok { $foo->v_lazy_Str() } '... undef is NOT a Foo->Str'; +dies_ok { $foo->v_lazy_String() } '... undef is NOT a Foo->String'; +done_testing;