Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 26 lines (20 sloc) 0.591 kb
d624404 [t/spec] Move t/blocks/return_function.t to t/spec/S06.
bacek authored
1 use Test; plan 4;
2
3 # L<S06/The C<return> function/prints 1 via named argument>
4
5 {
6 sub f () { return :x<1> }
7 sub g ($x) { $x }
8
9 my $x := |(f); # binds 1 to $x, via a named argument
10 #?pugs todo 'bug'
11 is $x, 1, 'binds 1 to $x, via a named argument';
12 is( g(|(f)), 1, "prints 1, via a named argument");
13 }
14
15 {
16 # return two positional Pair objects
17 sub t2 () { return( (:x<1>), (:y<2>) ) }
18 my ($rv1, $rv2);
19 try { ($rv1, $rv2) := |(t2) };
20 #?pugs 2 todo 'bug'
21 is($rv1, Pair, "returned Pair object 1");
22 is($rv2, Pair, "returned Pair object 2");
23 }
24
cbe775a [t/spec] README: section about CWD in test files
moritz authored
25 # vim: ft=perl6
Something went wrong with that request. Please try again.