From fa10441981c89deec914ba243360b40c5aede6ed Mon Sep 17 00:00:00 2001 From: Matt Valentine-House Date: Tue, 8 Oct 2024 12:16:14 +0100 Subject: Expose GC.config[:implementation], to query the currently active GC And a default and readonly key to the GC.config hash that names the current GC implementation. This is provided by each implementation by the API function rb_gc_impl_active_gc_name --- test/ruby/test_gc.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index f0ab0b0c1a..1eb5451b3f 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -117,6 +117,21 @@ class TestGc < Test::Unit::TestCase GC.start end + def test_gc_config_implementation + omit unless /darwin|linux/.match(RUBY_PLATFORM) + + gc_name = (ENV['RUBY_GC_LIBRARY'] || "default") + assert_equal gc_name, GC.config[:implementation] + end + + def test_gc_config_implementation_is_readonly + omit unless /darwin|linux/.match(RUBY_PLATFORM) + + impl = GC.config[:implementation] + GC.config(implementation: "somethingelse") + assert_equal(impl, GC.config[:implementation]) + end + def test_start_full_mark return unless use_rgengc? omit 'stress' if GC.stress -- cgit v1.2.3