Skip to content

Commit

Permalink
[t/spec] add basic tests for slurpy parameters
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@22019 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Aug 22, 2008
1 parent 655f17c commit dc30b33
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions S06-signature/slurpy-params.t
Original file line number Diff line number Diff line change
@@ -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.