diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index ccb46aeb9bd29b..a12b076e53f880 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -701,7 +701,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