summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 5694d2f01e..82eba0b352 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -879,6 +879,14 @@ class TestHash < Test::Unit::TestCase
assert_equal([1.0,1], {1.0=>1}.assoc(1))
end
+ def test_assoc_compare_by_identity
+ h = {}
+ h.compare_by_identity
+ h["a"] = 1
+ h["a"] = 2
+ assert_equal(["a",1], h.assoc("a"))
+ end
+
def test_rassoc
assert_equal([3,4], {1=>2, 3=>4, 5=>6}.rassoc(4))
assert_nil({1=>2, 3=>4, 5=>6}.rassoc(3))