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 (32 sloc) 0.999 kB
use v6;
use Test;
plan 7;
sub my_first ($x, $, $ ) { $x };
sub my_second ($, $x, $ ) { $x };
sub my_third ($, $, $x) { $x };
is my_first( 4, 5, 6), 4, '($x, $, $) works as a signature';
is my_second(4, 5, 6), 5, '($, $x, $) works as a signature';
is my_third( 4, 5, 6), 6, '($, $, $x) works as a signature';
# RT #60408
{
sub rt60408 {
return { @_.join };
}
is rt60408().(1, 2, 3), '123', '@_ belongs to the inner-most block';
}
{
sub f(@a, $i) {
$i ~ "[{map { f($_, $i + 1) }, @a}]"
};
is f([[], [[]], []], 0), "0[1[] 1[2[]] 1[]]",
'recusion and parameter binding work out fine';
}
# using "special" variables as positional parameters
{
# RT #77054
sub dollar-underscore($x, $y, $_, $z) { "$x $y $_ $z"; }
is dollar-underscore(1,2,3,4), '1 2 3 4', '$_ works as parameter name';
sub dollar-slash($x, $/, $y) { "$x $<b> $y" }
is dollar-slash(1, { b => 2 }, 3), '1 2 3', '$/ works as parameter name';
}
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.