summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-05 05:38:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-05 05:38:15 +0000
commit19be85f7d1ca47266ab6e0435fa0f3a41aa59fad (patch)
treed4abe876d06e38214253bd94d946fe7f39ae5e16 /test/ruby
parent1402333810cae580ffe90e2cc635a47ed4be8f68 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_hash.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 98555824bc..6aaba469db 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -1111,6 +1111,32 @@ class TestHash < Test::Unit::TestCase
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]'