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