aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_assignment.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-10 11:57:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-10 11:57:51 +0000
commite6f6c77d1dc368e240dcb6b827e9e868efb6c06f (patch)
tree5d2f68fa1a4f53f5b09803b1dfe7cb063ec232f2 /test/ruby/test_assignment.rb
parenta5beed9ff467be394afc4957f0c9b12765c81743 (diff)
downloadruby-e6f6c77d1dc368e240dcb6b827e9e868efb6c06f.tar.gz
compile.c: fix lhs splat in massign
* compile.c (compile_massign_lhs): when index ends with splat, append rhs value to it like POSTARG, since VM_CALL_ARGS_SPLAT splats the last argument only. [ruby-core:72777] [Bug #11970] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_assignment.rb')
-rw-r--r--test/ruby/test_assignment.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_assignment.rb b/test/ruby/test_assignment.rb
index d0f2fadeaa..daf1f0a9be 100644
--- a/test/ruby/test_assignment.rb
+++ b/test/ruby/test_assignment.rb
@@ -758,4 +758,12 @@ class TestAssignmentGen < Test::Unit::TestCase
o = bug9448.new
assert_equal("ok", o['current'] = "ok")
end
+
+ def test_massign_aref_lhs_splat
+ bug11970 = '[ruby-core:72777] [Bug #11970]'
+ h = {}
+ k = [:key]
+ h[*k], = ["ok", "ng"]
+ assert_equal("ok", h[:key], bug11970)
+ end
end