Add TestProc#test_hash_equal

This commit is contained in:
Peter Zhu 2024-10-31 10:52:24 -04:00
parent 53b3fac6d2
commit 813286762c
Notes: git 2024-11-01 14:50:10 +00:00

View File

@ -159,6 +159,26 @@ class TestProc < Test::Unit::TestCase
assert_equal(*m_nest{}, "[ruby-core:84583] Feature #14627")
end
def test_hash_equal
# iseq backed proc
p1 = proc {}
p2 = p1.dup
assert_equal p1.hash, p2.hash
# ifunc backed proc
p1 = {}.to_proc
p2 = p1.dup
assert_equal p1.hash, p2.hash
# symbol backed proc
p1 = :hello.to_proc
p2 = :hello.to_proc
assert_equal p1.hash, p2.hash
end
def test_hash_uniqueness
def self.capture(&block)
block