Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
ko1 committed Dec 15, 2023
1 parent 473d191 commit f788ff3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/ruby/test_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2303,4 +2303,26 @@ def test_compare_by_identity_during_iteration
end
end
end

def test_ar_hash_to_st_hash
assert_normal_exit("#{<<~"begin;"}\n#{<<~'end;'}", 'https://bugs.ruby-lang.org/issues/20050#note-5')
begin;
srand(0)
class Foo
def to_a
[]
end
def hash
$h.delete($h.keys.sample) if rand < 0.1
to_a.hash
end
end
1000.times do
$h = {}
(0..10).each {|i| $h[Foo.new] ||= {} }
end
end;
end
end

0 comments on commit f788ff3

Please sign in to comment.