Add TestProc#test_hash_equal
This commit is contained in:
parent
53b3fac6d2
commit
813286762c
Notes:
git
2024-11-01 14:50:10 +00:00
@ -159,6 +159,26 @@ class TestProc < Test::Unit::TestCase
|
|||||||
assert_equal(*m_nest{}, "[ruby-core:84583] Feature #14627")
|
assert_equal(*m_nest{}, "[ruby-core:84583] Feature #14627")
|
||||||
end
|
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 test_hash_uniqueness
|
||||||
def self.capture(&block)
|
def self.capture(&block)
|
||||||
block
|
block
|
||||||
|
Loading…
x
Reference in New Issue
Block a user