diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index a1229fc87aeede..e9b452c7021a7a 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -703,7 +703,9 @@ def allocate_large_object = Array.new(10) allocate_large_object end - assert_operator(GC.stat(:heap_available_slots), :<, COUNT * 2) + heap_available_slots = GC.stat(:heap_available_slots) + + assert_operator(heap_available_slots, :<, COUNT * 2, "GC.stat: #{GC.stat}\nGC.stat_heap: #{GC.stat_heap}") RUBY end