more tests and tweaks
[gitmo/MooseX-AttributeHelpers.git] / t / 003_basic_hash.t
index 3748a3f..f2f73df 100644 (file)
@@ -4,6 +4,7 @@ use strict;
 use warnings;
 
 use Test::More no_plan => 1;
+use Test::Exception;
 
 BEGIN {
     use_ok('MooseX::AttributeHelpers');   
@@ -42,18 +43,27 @@ is($stuff->num_options, 0, '... we have no options');
 
 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';