summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Valentine-House <[email protected]>2024-10-08 12:16:14 +0100
committerMatt Valentine-House <[email protected]>2024-11-14 10:46:36 +0000
commitfa10441981c89deec914ba243360b40c5aede6ed (patch)
tree7ccc18e86359840d8ccac77c92f26f6f2f52f054 /test
parent8a4ce4e9a9245c67f5b2b3c360c1400a16ad2c58 (diff)
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
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11872
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_gc.rb15
1 files changed, 15 insertions, 0 deletions
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