use warnings;
use Test::More no_plan => 1;
+use Test::Exception;
BEGIN {
use_ok('MooseX::AttributeHelpers');
is_deeply($stuff->options, {}, '... no options yet');
-$stuff->set_option(foo => 'bar');
+lives_ok {
+ $stuff->set_option(foo => 'bar');
+} '... set the option okay';
ok($stuff->has_options, '... we have options');
is($stuff->num_options, 1, '... we have 1 option(s)');
is_deeply($stuff->options, { foo => 'bar' }, '... got options now');
-$stuff->set_option(bar => 'baz');
+lives_ok {
+ $stuff->set_option(bar => 'baz');
+} '... set the option okay';
is($stuff->num_options, 2, '... we have 2 option(s)');
is_deeply($stuff->options, { foo => 'bar', bar => 'baz' }, '... got more options now');
is($stuff->get_option('foo'), 'bar', '... got the right option');
+## check some errors
+
+dies_ok {
+ $stuff->set_option(bar => {});
+} '... could not add a hash ref where an string is expected';