From: Dave Rolsky Date: Fri, 29 Oct 2010 14:12:19 +0000 (-0500) Subject: Test that accessor works with lazy generation X-Git-Tag: 1.18~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=865faf6f10af3eed6852908c7a649a406aaa6504;p=gitmo%2FMoose.git Test that accessor works with lazy generation --- diff --git a/t/070_native_traits/050_trait_hash.t b/t/070_native_traits/050_trait_hash.t index f39040b..b64137b 100644 --- a/t/070_native_traits/050_trait_hash.t +++ b/t/070_native_traits/050_trait_hash.t @@ -24,6 +24,7 @@ use Test::Moose; has_option => 'exists', get_option => 'get', has_no_options => 'is_empty', + keys => 'keys', key_value => 'kv', set_option => 'set', ); @@ -243,6 +244,17 @@ sub run_tests { [ [ x => 1 ] ], 'kv returns lazy default' ); + + + $obj->_clear_options; + + $obj->option_accessor( y => 2 ); + + is_deeply( + [ sort $obj->keys ], + [ 'x', 'y' ], + 'accessor triggers lazy default generator' + ); } } $class;