Changeset 3143

Show
Ignore:
Timestamp:
05/13/05 09:16:20 (4 years ago)
Author:
scook0
svk:copy_cache_prev:
4718
Message:

Tests for slurpy hash params

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/subroutines/sub_named_params.t

    r2475 r3143  
    110110} 
    111111 
     112# Slurpy Hash Params 
     113{ 
     114sub slurp(*%args) { return %args } 
     115my %fellowship = slurp(hobbit => 'Frodo', wizard => 'Gandalf'); 
     116is(%fellowship<hobbit>, 'Frodo', "hobbit arg was slurped", :todo<bug>); 
     117is(%fellowship<wizard>, 'Gandalf', "wizard arg was slurped", :todo<bug>); 
     118is(%fellowship<dwarf>, undef, "dwarf arg was not given", :todo<bug>); 
     119is(+%fellowship, 2, "exactly 2 arguments were slurped", :todo<bug>); 
     120} 
     121 
     122{ 
     123sub named_and_slurp(+$grass, *%rest) { return($grass, %rest) } 
     124my ($grass, %rest) = named_and_slurp(sky => 'blue', grass => 'green', fire => 'red'); 
     125is($grass, 'green', "explicit named arg received despite slurpy hash", :todo<bug>); 
     126is(+%rest, 2, "exactly 2 arguments were slurped", :todo<bug>); 
     127is(%rest{sky}, 'blue', "sky argument was slurped", :todo<bug>); 
     128is(%rest{fire}, 'red', "fire argument was slurped", :todo<bug>); 
     129is(%rest{grass}, undef, "grass argument was NOT slurped", :todo<bug>); 
     130} 
     131 
    112132=kwid 
    113133