Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 22 lines (15 sloc) 0.395 kb
61d9105 [t/spec] add S06-signature/unpack-array.t
rhr authored
1 use v6;
2 use Test;
3 plan 3;
4
5 # L<S06/Unpacking array parameters>
6
67e4168 [t/spec] improve unpack-array.t a bit; remove item from TASK
moritz authored
7 sub foo($x, [$y, *@z]) {
8 return "$x|$y|" ~ @z.join(';');
61d9105 [t/spec] add S06-signature/unpack-array.t
rhr authored
9 }
10
67e4168 [t/spec] improve unpack-array.t a bit; remove item from TASK
moritz authored
11 my @a = 2, 3, 4, 5;
12 is foo(1, @a), '2|3|4;5', 'array unpacking';
61d9105 [t/spec] add S06-signature/unpack-array.t
rhr authored
13
67e4168 [t/spec] improve unpack-array.t a bit; remove item from TASK
moritz authored
14 sub bar([$x, $y, $z]) {
61d9105 [t/spec] add S06-signature/unpack-array.t
rhr authored
15 return [*] $x, $y, $z;
16 }
17
67e4168 [t/spec] improve unpack-array.t a bit; remove item from TASK
moritz authored
18 ok bar(@a[0..2]) == 24, 'fixed length array unpacking';
61d9105 [t/spec] add S06-signature/unpack-array.t
rhr authored
19 dies_ok { bar [1,2] }, 'fixed length array unpacking with wrong length';
67e4168 [t/spec] improve unpack-array.t a bit; remove item from TASK
moritz authored
20
21 # vim: ft=perl6
Something went wrong with that request. Please try again.