summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-10 06:02:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-10 06:02:54 +0000
commit813ad48975420867ccd1919972ba138f13c6f6e5 (patch)
tree9d0bf03a23e034f95c2940e8f2519af13fc9b419 /test
parent01bced94a91cda4c7d560b1f3f099099aa8c7930 (diff)
vm_insnhelper.c: fix implicit splat keyword argument
* vm_insnhelper.c (vm_callee_setup_keyword_arg): adjust VM stack pointer to get rid of overwriting splat arguments by arguments for `to_hash` conversion. [ruby-core:63593] [Bug #10016] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_keyword.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 68dd8a91cf..a7249381d8 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -463,6 +463,16 @@ class TestKeywordArguments < Test::Unit::TestCase
assert_equal({a: 1, b: 2}, m1(**o, **o2) {|x| break x}, bug9898)
end
+ def test_implicit_hash_conversion
+ bug10016 = '[ruby-core:63593] [Bug #10016]'
+
+ o = Object.new
+ def o.to_hash() { k: 9 } end
+ assert_equal([1, 42, [], o, :key, {}, nil], f9(1, o))
+ assert_equal([1, 9], m1(1, o) {|a, k: 0| break [a, k]}, bug10016)
+ assert_equal([1, 9], m1(1, o, &->(a, k: 0) {break [a, k]}), bug10016)
+ end
+
def test_gced_object_in_stack
bug8964 = '[ruby-dev:47729] [Bug #8964]'
assert_normal_exit %q{