X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F207_trait_string.t;h=d6d6783fadd4c5a12c41643bbec8010dcac795e5;hb=e0d340ca0cd12125cabbd39e9799e4fc77c2a703;hp=7eb470e2dd872ccca2a1e706b6541b9ec0f177e8;hpb=301da83f19b55bb13e0d4379ab3e9e6ad1504595;p=gitmo%2FMooseX-AttributeHelpers.git diff --git a/t/207_trait_string.t b/t/207_trait_string.t index 7eb470e..d6d6783 100644 --- a/t/207_trait_string.t +++ b/t/207_trait_string.t @@ -3,11 +3,11 @@ use strict; use warnings; -use Test::More tests => 27; +use Test::More tests => 30; use Test::Moose 'does_ok'; BEGIN { - use_ok('MooseX::AttributeHelpers'); + use_ok('MooseX::AttributeHelpers'); } { @@ -29,6 +29,7 @@ BEGIN { chomp => 'chomp_string', clear => 'clear_string', substr => 'sub_string', + length => 'length_string', }, curries => { append => {exclaim => [ '!' ]}, @@ -43,13 +44,15 @@ my $page = MyHomePage->new(); isa_ok($page, 'MyHomePage'); is($page->string, '', '... got the default value'); +is($page->length_string, 0, '... length is zero'); $page->string('a'); +is($page->length_string, 1, '... new string has length of one'); -$page->inc_string; +$page->inc_string; is($page->string, 'b', '... got the incremented value'); -$page->inc_string; +$page->inc_string; is($page->string, 'c', '... got the incremented value (again)'); $page->append_string("foo$/"); @@ -66,6 +69,7 @@ is($page->string, "cfo", 'chopped string'); $page->prepend_string("bar"); is($page->string, 'barcfo', 'prepended to string'); +is($page->length_string, 6, 'right length'); is_deeply( [ $page->match_string(qr/([ao])/) ], [ "a" ], "match" ); @@ -105,7 +109,7 @@ is($string->helper_type, 'Str', '... got the expected helper type'); is($string->type_constraint->name, 'Str', '... got the expected type constraint'); -is_deeply($string->provides, { +is_deeply($string->provides, { inc => 'inc_string', append => 'append_string', prepend => 'prepend_string', @@ -115,5 +119,6 @@ is_deeply($string->provides, { chomp => 'chomp_string', clear => 'clear_string', substr => 'sub_string', + length => 'length_string', }, '... got the right provides methods');