summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_proc.rb20
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