Skip to content

Commit c7708d2

Browse files
committed
Improve coverage of TestProc#test_hash_uniqueness
1 parent 8132867 commit c7708d2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/ruby/test_proc.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,18 @@ def self.capture(&block)
186186

187187
procs = Array.new(1000){capture{:foo }}
188188
assert_operator(procs.map(&:hash).uniq.size, :>=, 500)
189+
190+
# iseq backed proc
191+
unique_hashes = 1000.times.map { proc {}.hash }.uniq
192+
assert_operator(unique_hashes.size, :>=, 500)
193+
194+
# ifunc backed proc
195+
unique_hashes = 1000.times.map { {}.to_proc.hash }.uniq
196+
assert_operator(unique_hashes.size, :>=, 500)
197+
198+
# symbol backed proc
199+
unique_hashes = 1000.times.map { |i| :"test#{i}".to_proc.hash }.uniq
200+
assert_operator(unique_hashes.size, :>=, 500)
189201
end
190202

191203
def test_hash_does_not_change_after_compaction

0 commit comments

Comments
 (0)