f_map.t
Code test snippets here are adapted from `perldoc -f map`
Due to a bleadperl optimization (Dave Mitchell, circa may 04), the (map|grep)(start|while) opcodes have different flags in 5.9, their private flags /1, /2 are gone in blead (for the cases covered)
When the optree stuff was integrated into 5.8.6, these tests failed, and were todo'd. They're now done, by version-specific tweaking in mkCheckRex(), therefore the skip is removed too.
# chunk: #!perl # examples shamelessly snatched from perldoc -f map
# chunk: # translates a list of numbers to the corresponding characters. @chars = map(chr, @nums);
# chunk: %hash = map { getkey($_) => $_ } @array;
# chunk: { %hash = (); foreach $_ (@array) { $hash{getkey($_)} = $_; } }
# chunk: #%hash = map { "\L$_", 1 } @array; # perl guesses EXPR. wrong %hash = map { +"\L$_", 1 } @array; # perl guesses BLOCK. right
# chunk: %hash = map { ("\L$_", 1) } @array; # this also works
# chunk: %hash = map { lc($_), 1 } @array; # as does this.
# chunk: %hash = map +( lc($_), 1 ), @array; # this is EXPR and works!
# chunk: %hash = map ( lc($_), 1 ), @array; # evaluates to (1, @array)
# chunk: @hashes = map +{ lc($_), 1 }, @array # EXPR, so needs , at end