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(*@_) { + return @_; +} +@out = prototype_default_explicit(@in); +is ("@out[]","1 2 3 4","Explicit default prototype"); + +todo_is(eval( +'sub swap (*@_ is rw) { @_[0,1] = @_[1,0]; } +@in = 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"); +