Codebase list libmethod-signatures-perl / b9279e6
add test for optional placeholder Anthony Brummett 8 years ago
1 changed file(s) with 8 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
7373 throws_ok { Placeholder->slurpy_hash(123, 456, a => 1) }
7474 qr{was given an odd number of arguments for a placeholder hash},
7575 'slurpy_hash with odd number of extras throws exception';
76
77 method optional_placeholder($foo, $?, $bar?) {
78 return [ $foo, $bar ];
79 }
80
81 is_deeply( Placeholder->optional_placeholder(1), [ 1, undef ], 'optional_placeholder with 1 arg');
82 is_deeply( Placeholder->optional_placeholder(1, 2), [ 1, undef ], 'optional_placeholder with 2 args');
83 is_deeply( Placeholder->optional_placeholder(1, 2, 3), [ 1, 3 ], 'optional_placeholder with 3 args');
7684 }
7785
7886 done_testing();