Permalink
Browse files

[t/spec] add S06-signature/unpack-array.t

         STD doesn't seem to like this


git-svn-id: http://svn.pugscode.org/pugs@22758 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 8f3dd6d commit 61d9105f53d1f379612fe5702248987fbeadb56f rhr committed Oct 25, 2008
Showing with 19 additions and 0 deletions.
  1. +19 −0 S06-signature/unpack-array.t
@@ -0,0 +1,19 @@
+use v6;
+use Test;
+plan 3;
+
+# L<S06/Unpacking array parameters>
+
+sub foo($x, [$y, *@z] --> Num) {
+ return [+] $x, $y, @z;
+}
+
+my @a = 2, 3, 4;
+ok foo(1, @a) == 10, 'array unpacking';
+
+sub bar([$x, $y, $z], :$a --> Num) {
+ return [*] $x, $y, $z;
+}
+
+ok bar(@a) == 24, 'fixed length array unpacking';
+dies_ok { bar [1,2] }, 'fixed length array unpacking with wrong length';

0 comments on commit 61d9105

Please sign in to comment.