Skip to content

Commit

Permalink
[t/spec] tests for optional parameters, typed and untyped (RT #61528)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@24498 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Dec 19, 2008
1 parent 6e20293 commit 4ef6e53
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions S06-signature/optional.t
@@ -0,0 +1,17 @@
use v6;
use Test;

plan 4;

sub opt1($p?) { defined($p) ?? $p !! 'undef'; }

is opt1('abc'), 'abc', 'Can pass optional param';
is opt1(), 'undef', 'Can leave out optional param';

sub opt_typed(Int $p?) { defined($p) ?? $p !! 'undef' };

is opt_typed(2), 2, 'can pass optional typed param';
#?rakudo skip 'optional typed params, RT #61528'
is opt_typed() , 'undef', 'can leave out optional typed param';

# vim: ft=perl6

0 comments on commit 4ef6e53

Please sign in to comment.