On Tue, Mar 08, 2005 at 12:41:40PM +0100, Joost Diepenmaat wrote:

> +todo_is(eval(
> +'sub swap ([EMAIL PROTECTED] is rw) { @_[0,1] = @_[1,0]; } 
> [EMAIL PROTECTED] = qw(1 2); 
> +swap(@in);
> [EMAIL PROTECTED]'),
> +"2 1","swap");

Meh. That's wrong. 

it shoud be:

todo_is(eval(
'sub swap ([EMAIL PROTECTED] is rw) { @_[0,1] = @_[1,0]; } 
@in = qw(1 2); 
swap(@in);
"@in[]"'),
"2 1","swap");

Fixed patch attached.

Joost.



Index: t/06sub.t
===================================================================
--- t/06sub.t   (revision 524)
+++ t/06sub.t   (working copy)
@@ -9,7 +9,7 @@
 
 =cut
 
-plan 12;
+plan 17;
 
 sub foobar ($var) {
     return $var;
@@ -70,3 +70,29 @@
 is($_, "-wibble-", 'sub closures close');
 $_ = $block.();
 is($_, "-quux-", 'block closures close');
+
+
+sub prototype_default {
+    return @_;
+}
+my @in = qw(1 2 3 4);
+my @out = prototype_default(@in);
+is ("@out[]","1 2 3 4","Default prototype");
+
+sub prototype_default_explicit([EMAIL PROTECTED]) {
+    return @_;
+}
[EMAIL PROTECTED] = prototype_default_explicit(@in);
+is ("@out[]","1 2 3 4","Explicit default prototype");
+
+todo_is(eval(
+'sub swap ([EMAIL PROTECTED] is rw) { @_[0,1] = @_[1,0]; } 
[EMAIL PROTECTED] = qw(1 2); 
+swap(@in);
+"@in[]"'),
+"2 1","swap");
+
+sub numcmp ($x, $y) { return $x <=> $y }
+is(numcmp(2,7),-1,"numcmp 1");
+todo_is(eval('numcmp( y => 7, x => 2 )'),-1,"numcmp 2");
+

Reply via email to