From fd89be255f73f2cf3de35c3af4771d8ccb19ae0d Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 11 Mar 2017 14:48:04 +0000 Subject: merge revision(s) 57278,57279: [Backport #12855] fix optimization for hash aset/aref with fstring Patch by Eric Wong [ruby-core:78797]. I don't like the idea of making insns.def any bigger to support a corner case, and "test_hash_aref_fstring_identity" shows how contrived this is. [ruby-core:78783] [Bug #12855] adjust indent [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_hash.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index b79f9aa0cc..040d25e144 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -237,6 +237,19 @@ class TestHash < Test::Unit::TestCase assert_same a.keys[0], b.keys[0] end + def test_hash_aset_fstring_identity + h = {}.compare_by_identity + h['abc'] = 1 + h['abc'] = 2 + assert_equal 2, h.size, '[ruby-core:78783] [Bug #12855]' + end + + def test_hash_aref_fstring_identity + h = {}.compare_by_identity + h['abc'] = 1 + assert_nil h['abc'], '[ruby-core:78783] [Bug #12855]' + end + def test_NEWHASH_fstring_key a = {"ABC" => :t} b = {"ABC" => :t} -- cgit v1.2.3