summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Valentine-House <[email protected]>2024-10-08 21:30:06 +0100
committerMatt Valentine-House <[email protected]>2024-11-14 10:46:36 +0000
commitee290c94a3dd0327f3407edb02272d37470edc95 (patch)
tree941b26392942b9c927876079826f7c4a7ea0e776 /test
parentfa10441981c89deec914ba243360b40c5aede6ed (diff)
Include the currently active GC in RUBY_DESCRIPTION
This will add +MOD_GC to the version string and Ruby description when Ruby is compiled with shared gc support. When shared GC support is compiled in and a GC module has been loaded using RUBY_GC_LIBRARY, the version string will include the name of the currently active GC as reported by the rb_gc_active_gc_name function in the form +MOD_GC[gc_name] [Feature #20794]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11872
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_rubyoptions.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 89ebe8f21d..fd52255acd 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -176,7 +176,7 @@ class TestRubyOptions < Test::Unit::TestCase
VERSION_PATTERN_WITH_RJIT =
case RUBY_ENGINE
when 'ruby'
- /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT (\+MN )?(\+PRISM )?\[#{q[RUBY_PLATFORM]}\]$/
+ /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT (\+MN )?(\+PRISM )?(\+GC)?(\[\w+\]\s|\s)?\[#{q[RUBY_PLATFORM]}\]$/
else
VERSION_PATTERN
end
@@ -307,6 +307,16 @@ class TestRubyOptions < Test::Unit::TestCase
end
end
+ def test_enabled_gc
+ omit unless /linux|darwin/ =~ RUBY_PLATFORM
+
+ if RbConfig::CONFIG['shared_gc_dir'].length > 0
+ assert_match(/\+GC/, RUBY_DESCRIPTION)
+ else
+ assert_no_match(/\+GC/, RUBY_DESCRIPTION)
+ end
+ end
+
def test_parser_flag
assert_in_out_err(%w(--parser=prism -e) + ["puts :hi"], "", %w(hi), [])
assert_in_out_err(%w(--parser=prism --dump=parsetree -e _=:hi), "", /"hi"/, [])