diff options
author | Peter Zhu <[email protected]> | 2024-10-31 10:52:24 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-11-01 10:49:50 -0400 |
commit | 813286762c29e2f8d8f9cb077fecdac3a2ec7c09 (patch) | |
tree | b395ee0a640787d100bc2ba434bc9a3b575f8d54 | |
parent | 53b3fac6d2dd11fe2416eb159aed6f1c565451be (diff) |
Add TestProc#test_hash_equal
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11966
-rw-r--r-- | test/ruby/test_proc.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 57047fb0d4..5f21c8cf5d 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -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 |