diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-04 14:31:52 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-04 14:31:52 +0000 |
commit | 568472906b178607ee569bff0d3074c27515719e (patch) | |
tree | 2aa58a2e021f7a30b7091f5b1417782ec0d3e485 /test | |
parent | 91b51140d7f2b79f8fb7d0ea8901de89fa0304d6 (diff) |
merge revision(s) 59357,59358: [Backport #13391] [Backport #13404]
proc.c: rb_block_min_max_arity
* proc.c (rb_block_min_max_arity): new function to get arity range
from the current block.
vm_eval.c: rb_lambda_call
* enum.c (enum_collect): make the block arity same as the given
block. [Bug #13391]
* internal.h (vm_ifunc): store arity instead of unused id.
* proc.c (rb_vm_block_min_max_arity): return ifunc arity.
* vm_eval.c (rb_lambda_call): call method with lambda block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_enum.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index c70ec7ceba..51efac5150 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -798,6 +798,10 @@ class TestEnumerable < Test::Unit::TestCase lambda2 = ->(x, i) { [x.upcase, i] } assert_equal([['A',0], ['B',1], ['C',2], ['D',3], ['E',4]], @obj.each_with_index.map(&lambda2)) + + hash = { a: 'hoge', b: 'fuga' } + lambda = -> (k, v) { "#{k}:#{v}" } + assert_equal ["a:hoge", "b:fuga"], hash.map(&lambda) end def test_flat_map |