Codebase list liblist-objects-withutils-perl / e15acdf
hash->set test tweak Jon Portnoy 8 years ago
1 changed file(s) with 4 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
33 use List::Objects::WithUtils 'hash';
44 my $hr = hash;
55 ok $hr->set( snacks => 'tasty') == $hr, 'set returned self';
6 ok $hr->get('snacks') eq 'tasty', 'set ok';
6 ok $hr->get('snacks') eq 'tasty', 'set ok (1)';
7 $hr->set( foo => 'bar' );
8 ok $hr->get('foo') eq 'bar', 'set ok (2)';
79
810 $hr->set( a => 1, b => 2, c => 3 );
911 is_deeply
1012 +{ $hr->export },
11 +{ a => 1, b => 2, c => 3, snacks => 'tasty' },
13 +{ a => 1, b => 2, c => 3, snacks => 'tasty', foo => 'bar' },
1214 'multi-key set ok';
1315
1416 done_testing;