From a259ce406f14f3e044beaa35a16b650920e248d1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 15 Jun 2025 22:22:30 +0900 Subject: Simplify weak_references count test initialization Using an enumerator does not resolve the intermittent failures: 100+ failures in 10,000 iterations. --- test/ruby/test_gc.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index daa645b349..953baf9928 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -393,12 +393,10 @@ class TestGc < Test::Unit::TestCase # Create some objects and place it in a WeakMap wmap = ObjectSpace::WeakMap.new - ary = Array.new(count) - enum = count.times - enum.each.with_index do |i| + ary = Array.new(count) do |i| obj = Object.new - ary[i] = obj wmap[obj] = nil + obj end # Run full GC to collect stats about weak references -- cgit v1.2.3