summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-30 00:00:23 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-30 00:00:23 +0000
commitfc939f669730844b47e761b11e0f7058f113031f (patch)
tree8964cc9540122e2f985d81c8879494ebad0b840d /test
parent634a48c5c1eba9d0d663759faf0c2156007a403a (diff)
hash literal deduplicates like Hash#[]=
From: Eric Wong <e@80x24.org> * hash.c (rb_hash_key_str): new function (hash_aset_str): use rb_hash_key_str * internal.h: add rb_hash_key_str * st.c (st_stringify): use rb_hash_key_str * test/ruby/test_hash.rb (test_NEWHASH_fstring_key): dynamic key [ruby-core:84554] [Feature #14258] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 7162f9d01f..313c2fd9de 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -298,6 +298,9 @@ class TestHash < Test::Unit::TestCase
b = {"ABC" => :t}
assert_same a.keys[0], b.keys[0]
assert_same "ABC".freeze, a.keys[0]
+ var = +'ABC'
+ c = { var => :t }
+ assert_same "ABC".freeze, c.keys[0]
end
def test_tainted_string_key