From 0fc737483d1182f5011fc66c62c49e987300bdb7 Mon Sep 17 00:00:00 2001 From: Oleksii Leonov Date: Sat, 2 Dec 2023 16:08:27 +0000 Subject: [PATCH] fix: use expand_heap for Ruby 3.2.0+ Summary Starting Ruby 3.2.0 `GC.verify_compaction_references(expand_heap: true, toward: :empty)` should be used instead of `GC.verify_compaction_references(double_heap: true, toward: :empty)`. Before: ```shell ruby -Ilib:test test/geos_capi/polygon_test.rb :251: warning: double_heap is deprecated, please use expand_heap instead # ... ``` After: ```shell ruby -Ilib:test test/geos_capi/polygon_test.rb # ... ``` --- test/test_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 3d65654f..1a0ec0ce 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -40,7 +40,11 @@ def geos_version_match(requirement) # Static test for missed references in our CAPI codebase (or FFI interface). # See https://alanwu.space/post/check-compaction/ if defined?(GC.verify_compaction_references) == "method" - GC.verify_compaction_references(double_heap: true, toward: :empty) + if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2.0") + GC.verify_compaction_references(expand_heap: true, toward: :empty) + else + GC.verify_compaction_references(double_heap: true, toward: :empty) + end end # Live test for our implementation of Ruby's compaction methods (rb_gc_mark_movable