diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-18 08:31:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-18 08:31:02 +0000 |
commit | 7c3a8ebdc42e78a96f2ffc6c3c2740b3291d1b0a (patch) | |
tree | 7d61b1b855149f8a357603065e85761cb7d43202 /test/ruby/test_enum.rb | |
parent | dbe170316c6777e1fc696555e8ec5eb9740b57b5 (diff) | |
download | ruby-7c3a8ebdc42e78a96f2ffc6c3c2740b3291d1b0a.tar.gz |
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/trunk@59358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enum.rb')
-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 c36cb43537..fcf601c183 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -837,6 +837,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 |