Permalink
Browse files

[t/spec] Move t/blocks/return_function.t to t/spec/S06.

git-svn-id: http://svn.pugscode.org/pugs@25855 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 7ba0e44 commit d6244047bd53d1d31c121f4b13f0801562bdf845 bacek committed Mar 16, 2009
Showing with 24 additions and 0 deletions.
  1. +24 −0 S06-advanced_subroutine_features/return_function.t
@@ -0,0 +1,24 @@
+use Test; plan 4;
+
+# L<S06/The C<return> function/prints 1 via named argument>
+
+{
+ sub f () { return :x<1> }
+ sub g ($x) { $x }
+
+ my $x := |(f); # binds 1 to $x, via a named argument
+ #?pugs todo 'bug'
+ is $x, 1, 'binds 1 to $x, via a named argument';
+ is( g(|(f)), 1, "prints 1, via a named argument");
+}
+
+{
+ # return two positional Pair objects
+ sub t2 () { return( (:x<1>), (:y<2>) ) }
+ my ($rv1, $rv2);
+ try { ($rv1, $rv2) := |(t2) };
+ #?pugs 2 todo 'bug'
+ is($rv1, Pair, "returned Pair object 1");
+ is($rv2, Pair, "returned Pair object 2");
+}
+

0 comments on commit d624404

Please sign in to comment.