From: Mike Whitaker Date: Thu, 23 Oct 2008 10:42:43 +0000 (+0000) Subject: extra tests for exists helper X-Git-Tag: 0.16~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9bfd5e92528d455492b20b507c3d1e1e93dc4a0f;p=gitmo%2FMooseX-AttributeHelpers.git extra tests for exists helper --- diff --git a/t/003_basic_hash.t b/t/003_basic_hash.t index 5f29544..1f48afc 100644 --- a/t/003_basic_hash.t +++ b/t/003_basic_hash.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 37; +use Test::More tests => 39; use Test::Exception; BEGIN { @@ -27,6 +27,7 @@ BEGIN { 'count' => 'num_options', 'clear' => 'clear_options', 'delete' => 'delete_option', + 'exists' => 'has_option', }, curries => { 'set' => { @@ -46,6 +47,7 @@ can_ok($stuff, $_) for qw[ num_options delete_option clear_options + has_option ]; ok(!$stuff->has_options, '... we have no options'); @@ -59,6 +61,7 @@ lives_ok { ok($stuff->has_options, '... we have options'); is($stuff->num_options, 1, '... we have 1 option(s)'); +ok($stuff->has_option('foo'), '... we have a foo option'); is_deeply($stuff->options, { foo => 'bar' }, '... got options now'); lives_ok { @@ -102,7 +105,7 @@ lives_ok { $stuff->set_quantity(4); } '... options added okay with defaults'; -is_deeply($stuff->options, {quantity => 4}); +is_deeply($stuff->options, {quantity => 4}, '... returns what we expect'); lives_ok { Stuff->new(options => { foo => 'BAR' }); @@ -130,6 +133,7 @@ is_deeply($options->provides, { 'count' => 'num_options', 'clear' => 'clear_options', 'delete' => 'delete_option', + 'exists' => 'has_option', }, '... got the right provies mapping'); is($options->type_constraint->type_parameter, 'Str', '... got the right container type');