Permalink
Browse files

Add a test for slurpy placeholders.

git-svn-id: http://svn.pugscode.org/pugs@20402 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent ba01c99 commit 5dd160caf2ffe193088b8038fab94c0f33f88408 tene committed May 11, 2008
Showing with 29 additions and 0 deletions.
  1. +29 −0 S06-signature/slurpy-placeholders.t
View
29 S06-signature/slurpy-placeholders.t
@@ -0,0 +1,29 @@
+use v6;
+use Test;
+
+plan 6;
+
+#L<S06/Placeholder variables/>
+
+sub positional_slurpy {
+ is @_[0], 1, "Leftover positional args get passed to @_ if present";
+}
+
+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));
+
+# vim: syn=perl6

0 comments on commit 5dd160c

Please sign in to comment.