X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F002_basic_array.t;h=fbd71762edd0a1c63a35e69d345b5e79a121f993;hb=77d02b8b55108cc6819c456152fc2d504c5cd069;hp=479269e9b1af3fa9c3b32edf503ddec31200116e;hpb=8a6b3adde88036ee3ce2530103d884464f9e5e42;p=gitmo%2FMooseX-AttributeHelpers.git diff --git a/t/002_basic_array.t b/t/002_basic_array.t index 479269e..fbd7176 100644 --- a/t/002_basic_array.t +++ b/t/002_basic_array.t @@ -32,7 +32,7 @@ BEGIN { ); } -my $stuff = Stuff->new(); +my $stuff = Stuff->new(options => [ 10, 12 ]); isa_ok($stuff, 'Stuff'); can_ok($stuff, $_) for qw[ @@ -46,7 +46,15 @@ can_ok($stuff, $_) for qw[ has_options ]; -is_deeply($stuff->options, [], '... no options yet'); +is_deeply($stuff->options, [10, 12], '... got options'); + +ok($stuff->has_options, '... we have options'); +is($stuff->num_options, 2, '... got 2 options'); + +is($stuff->remove_last_option, 12, '... removed the last option'); +is($stuff->remove_first_option, 10, '... removed the last option'); + +is_deeply($stuff->options, [], '... no options anymore'); ok(!$stuff->has_options, '... no options'); is($stuff->num_options, 0, '... got no options'); @@ -113,6 +121,10 @@ dies_ok { $stuff->set_option(5, {}); } '... could not add a hash ref where an int is expected'; +dies_ok { + Stuff->new(options => [ 'Foo', 10, 'Bar', 20 ]); +} '... bad constructor params'; + ## test the meta my $options = $stuff->meta->get_attribute('options');