add test for optional placeholder
Anthony Brummett
8 years ago
73 | 73 | throws_ok { Placeholder->slurpy_hash(123, 456, a => 1) } |
74 | 74 | qr{was given an odd number of arguments for a placeholder hash}, |
75 | 75 | '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'); | |
76 | 84 | } |
77 | 85 | |
78 | 86 | done_testing(); |