Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (30 sloc) 0.897 kB
use v6;
use Test;
plan 8;
#L<S06/Placeholder variables/>
sub positional_slurpy {
is @_[0], 1, "Leftover positional args get passed to @_ if present";
is +@_, 1, 'one item filled into @_';
}
positional_slurpy(1);
sub named_slurpy {
is %_<a>, 1, "Leftover named args get passed to %_ if present";
}
named_slurpy(:a(1));
sub both {
is @_[1], 3, "Positional and named placeholder slurpies play well together";
is %_<a>, 4, "Positional and named placeholder slurpies play well together";
is @_[0], 5, "Positional and named placeholder slurpies play well together";
is %_<b>, 6, "Positional and named placeholder slurpies play well together";
}
both(5, :b(6), 3, :a(4));
{
my @result;
sub perl5sub {
push @result, @_[0];
push @result, @_[1];
}
perl5sub(<foo bar>);
is(@result, [<foo bar>], 'use @_ in sub');
}
# vim: syn=perl6
Jump to Line
Something went wrong with that request. Please try again.