summaryrefslogtreecommitdiff
path: root/test/ruby/test_weakmap.rb
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2023-03-14 09:12:55 +0100
committerJean Boussier <jean.boussier@gmail.com>2023-03-14 16:49:23 +0100
commit548086b34e3dd125edabf5dc1e46b891fad3ea9c (patch)
tree6c147bc459e5c90e3c7efefc742d699f947c9a15 /test/ruby/test_weakmap.rb
parentac65ce16e904695ba45888d3fba641d12caf733a (diff)
ObjectSpace::WeakMap: fix compaction support
[Bug #19529] `rb_gc_update_tbl_refs` can't be used on `w->obj2wmap` because it's not a `VALUE -> VALUE` table, but a `VALUE -> VALUE *` table, so we need some dedicated iterator.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7518
Diffstat (limited to 'test/ruby/test_weakmap.rb')
-rw-r--r--test/ruby/test_weakmap.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_weakmap.rb b/test/ruby/test_weakmap.rb
index 86550cc221..d84eb8241e 100644
--- a/test/ruby/test_weakmap.rb
+++ b/test/ruby/test_weakmap.rb
@@ -176,4 +176,12 @@ class TestWeakMap < Test::Unit::TestCase
end
end;
end
+
+ def test_compaction_bug_19529
+ obj = Object.new
+ 100.times do |i|
+ GC.compact
+ @wm[i] = obj
+ end
+ end
end