ruby-changes:31923
From: nobu <ko1@a...>
Date: Thu, 5 Dec 2013 14:38:23 +0900 (JST)
Subject: [ruby-changes:31923] nobu:r44002 (trunk): test_hash.rb: import tests from rubyspec
nobu 2013-12-05 14:38:15 +0900 (Thu, 05 Dec 2013) New Revision: 44002 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44002 Log: test_hash.rb: import tests from rubyspec * test/ruby/test_hash.rb: import tests for recursive hash values from rubyspec/core/{array,hash}/hash_spec.rb. Modified files: trunk/test/ruby/test_hash.rb Index: test/ruby/test_hash.rb =================================================================== --- test/ruby/test_hash.rb (revision 44001) +++ test/ruby/test_hash.rb (revision 44002) @@ -1111,6 +1111,32 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L1111 assert_same(obj, h[[[a]]]) end + def test_recursive_hash_value_array_hash + h = @cls[] + rec = [h] + h[:x] = rec + + obj = Object.new + h2 = {rec => obj} + [h, {x: rec}].each do |k| + k = [k] + assert_same(obj, h2[k], ->{k.inspect}) + end + end + + def test_recursive_hash_value_hash_array + h = @cls[] + rec = [h] + h[:x] = rec + + obj = Object.new + h2 = {h => obj} + [rec, [h]].each do |k| + k = {x: k} + assert_same(obj, h2[k], ->{k.inspect}) + end + end + def test_exception_in_rehash bug9187 = '[ruby-core:58728] [Bug #9187]' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/