Skip to content
Browse files

[t/spec] add basic tests for slurpy parameters

git-svn-id: http://svn.pugscode.org/pugs@22019 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 655f17c commit dc30b334f92f1ab731e6678cc61490b48ccaba39 moritz committed Aug 22, 2008
Showing with 20 additions and 0 deletions.
  1. +20 −0 S06-signature/slurpy-params.t
View
20 S06-signature/slurpy-params.t
@@ -0,0 +1,20 @@
+use v6;
+use Test;
+
+plan 6;
+
+sub xelems(*@args) { @args.elems }
+sub xjoin(*@args) { @args.join('|') }
+
+is xelems(1), 1, 'Basic slurpy params 1';
+is xelems(1, 2, 5), 3, 'Basic slurpy params 2';
+
+is xjoin(1), '1', 'Basic slurpy params 3';
+is xjoin(1, 2, 5), '1|2|5', 'Basic slurpy params 4';
+
+sub mixed($pos1, *@slurp) { "|$pos1|" ~ @slurp.join('!') }
+
+is mixed(1), '|1|', 'Positional and slurp params';
+is mixed(1, 2, 3), '|1|2!3', 'Positional and slurp params';
+
+# vim: ft=perl6

0 comments on commit dc30b33

Please sign in to comment.
Something went wrong with that request. Please try again.