Skip to content

Commit

Permalink
[dotnet] We now pass 22-optional-args.t.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Oct 20, 2010
1 parent 0c0d5df commit aa37f0f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions t/nqp/22-optional-args.t
@@ -0,0 +1,30 @@
#! nqp

# test optional arguments and parameters

plan(3);

sub f1 ($x, $y!, $z?) {
$x;
}
say('ok ', f1(1, 2), ' # optional args ignorable');
say('ok ', f1(2, 2, 2), ' # optional args passable');

sub f2 ($x?, $y?) { 'ok 3 # only optional args'; }
say(f2());

# TODO we can't parse .defined() yet - jg
#sub f3 ($x, $y?, $text?) {
# if ! $y.defined() && ! $text.defined() {
# say('ok 4 # unpassed optional args are undef');
# } else {
# say('ok ', $x - $y, $text);
# }
#}
#f3(2);
#f3(8, 3, ' # optional args get passed values');
#f3(8, :text(' # optional args specifiable by name'), :y(2));

# XXX: need to be able to test that the following is illegal
#sub f4 ($x?, $y) { $y; }

0 comments on commit aa37f0f

Please sign in to comment.