summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_weakkeymap.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_weakkeymap.rb b/test/ruby/test_weakkeymap.rb
index 6b3ffbb81f..91c1538076 100644
--- a/test/ruby/test_weakkeymap.rb
+++ b/test/ruby/test_weakkeymap.rb
@@ -61,6 +61,20 @@ class TestWeakKeyMap < Test::Unit::TestCase
refute @wm[k]
end
+ def test_clear_bug_20691
+ assert_normal_exit(<<~RUBY)
+ map = ObjectSpace::WeakKeyMap.new
+
+ 1_000.times do
+ 1_000.times do
+ map[Object.new] = nil
+ end
+
+ map.clear
+ end
+ RUBY
+ end
+
def test_inspect
x = Object.new
k = Object.new