From: 2shortplanks Date: Wed, 9 Sep 2009 09:05:40 +0000 (+0100) Subject: Document and test that deleting multiple keys from the hash with the delete trait... X-Git-Tag: 0.89_02~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9d010f57f95d0b16078339ddea88e9f69b2067df;p=gitmo%2FMoose.git Document and test that deleting multiple keys from the hash with the delete trait is okay --- diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm index 4d17810..d40fb52 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm @@ -70,13 +70,13 @@ Returns values from the hash. In list context return a list of values in the hash for the given keys. In scalar context returns the value for the last key specified. -=item B $value, $key2 =E $value2 ...)> +=item B $value, $key2 =E $value2...)> Sets the elements in the hash to the given values. -=item B +=item B -Removes the element with the given key. +Removes the elements with the given keys. =item B diff --git a/t/070_native_traits/203_trait_hash.t b/t/070_native_traits/203_trait_hash.t index 7d63286..a7d77f4 100644 --- a/t/070_native_traits/203_trait_hash.t +++ b/t/070_native_traits/203_trait_hash.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 47; +use Test::More tests => 46; use Test::Exception; use Test::Moose 'does_ok'; @@ -99,14 +99,9 @@ lives_ok { '... deleted the option okay'; lives_ok { - $stuff->delete_option('oink'); + $stuff->delete_option('oink','xxy'); } -'... deleted the option okay'; - -lives_ok { - $stuff->delete_option('xxy'); -} -'... deleted the option okay'; +'... deleted multiple option okay'; is( $stuff->num_options, 1, '... we have 1 option(s)' ); is_deeply( $stuff->options, { foo => 'bar' }, '... got more options now' );