diff --git a/test/stdlib/GC_test.rb b/test/stdlib/GC_test.rb index 27f5db629..dd9fdea6e 100644 --- a/test/stdlib/GC_test.rb +++ b/test/stdlib/GC_test.rb @@ -76,6 +76,10 @@ def test_stat def test_stress_and_stress= old_stress = GC.stress + # Stress mode runs a full GC on every allocation, and the assertions below allocate + # heavily while parsing and type checking. Only the types of the return values matter + # here, so keep GC disabled and let stress mode stay inert. + was_disabled = GC.disable assert_send_type '() -> (Integer | bool)', GC, :stress @@ -92,6 +96,7 @@ def test_stress_and_stress= end ensure GC.stress = old_stress + GC.enable unless was_disabled end def test_total_time