summaryrefslogtreecommitdiff
path: root/test/ruby/test_rubyoptions.rb
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-07-17 17:32:11 -0400
committerKevin Newton <[email protected]>2024-07-18 13:03:17 -0400
commit76ea5cde2a0f4834a5228104249b6b3346ddfc94 (patch)
tree273fd1821d18b98ce845c6321f7e8aa615b6ab05 /test/ruby/test_rubyoptions.rb
parentaa3030ac24389f838fd85390601489c60fd13877 (diff)
Refactor RUBY_DESCRIPTION assertions in test_rubyoptions
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11192
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r--test/ruby/test_rubyoptions.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 3215f25f92..b6f0e131f0 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -13,7 +13,12 @@ class TestRubyOptions < Test::Unit::TestCase
# Here we're defining our own RUBY_DESCRIPTION without "+PRISM". We do this
# here so that the various tests that reference RUBY_DESCRIPTION don't have to
# worry about it. The flag itself is tested in its own test.
- RUBY_DESCRIPTION = ::RUBY_DESCRIPTION.sub(/\+PRISM /, '')
+ RUBY_DESCRIPTION =
+ if EnvUtil.invoke_ruby(["-v"], "", true, false)[0].include?("+PRISM")
+ ::RUBY_DESCRIPTION
+ else
+ ::RUBY_DESCRIPTION.sub(/\+PRISM /, '')
+ end
NO_JIT_DESCRIPTION =
if rjit_enabled?
@@ -163,14 +168,14 @@ class TestRubyOptions < Test::Unit::TestCase
/^jruby #{q[RUBY_ENGINE_VERSION]} \(#{q[RUBY_VERSION]}\).*? \[#{
q[RbConfig::CONFIG["host_os"]]}-#{q[RbConfig::CONFIG["host_cpu"]]}\]$/
else
- /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \[#{q[RUBY_PLATFORM]}\]$/
+ /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? (\+PRISM )?\[#{q[RUBY_PLATFORM]}\]$/
end
private_constant :VERSION_PATTERN
VERSION_PATTERN_WITH_RJIT =
case RUBY_ENGINE
when 'ruby'
- /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT (\+MN )?\[#{q[RUBY_PLATFORM]}\]$/
+ /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT (\+MN )?(\+PRISM )?\[#{q[RUBY_PLATFORM]}\]$/
else
VERSION_PATTERN
end