use v6;
use Test;
plan 3;

# L<S06/Unpacking array parameters>

sub foo($x, [$y, *@z]) {
    return "$x|$y|" ~ @z.join(';');
}

my @a = 2, 3, 4, 5;
is foo(1, @a), '2|3|4;5',  'array unpacking';

sub bar([$x, $y, $z]) {
    return [*] $x, $y, $z;
}

ok bar(@a[0..2]) == 24, 'fixed length array unpacking';
dies_ok { bar [1,2] }, 'fixed length array unpacking with wrong length';

# vim: ft=perl6

use v6;
use Test;
plan 3;

# L<S06/Unpacking array parameters>

sub foo($x, [$y, *@z]) {
    return "$x|$y|" ~ @z.join(';');
}

my @a = 2, 3, 4, 5;
is foo(1, @a), '1|2|3;4;5',  'array unpacking';

sub bar([$x, $y, $z]) {
    return $x * $y * $z;
}

ok bar(@a[0..2]) == 24, 'fixed length array unpacking';
dies_ok { bar [1,2] }, 'fixed length array unpacking with wrong length';

# vim: ft=perl6

Correct mistake in array unpacking test, and make it work without reduction operator.
[t/spec] Correct mistake in array unpacking test, and make it work without reduction operator.

git-svn-id: 53605643c415f7495558be95614cf14171f1db78@29753 c213334d-75ef-0310-aa23-eaa082d1ae64
