diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-12-04 16:40:02 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-12-04 16:45:54 +0100 |
commit | b4ec4a41c24105efbb43f9b70ca7f36d22f98294 (patch) | |
tree | 6e257f60ef031d6ea815123c0ce0ed85e10a66be /test/ruby/test_rubyoptions.rb | |
parent | 83e983ab61b532d17a1177c66e3e43a5042edc1f (diff) | |
download | ruby-b4ec4a41c24105efbb43f9b70ca7f36d22f98294.tar.gz |
Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) &&
* Otherwise those tests, etc cannot run on alternative Ruby implementations.
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 6ca8dbea33..be08ec6acc 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -8,7 +8,7 @@ require_relative '../lib/jit_support' class TestRubyOptions < Test::Unit::TestCase NO_JIT_DESCRIPTION = - if RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE RUBY_DESCRIPTION.sub(/\+JIT /, '') else RUBY_DESCRIPTION @@ -117,7 +117,7 @@ class TestRubyOptions < Test::Unit::TestCase def test_verbose assert_in_out_err(["-vve", ""]) do |r, e| assert_match(VERSION_PATTERN, r[0]) - if RubyVM::MJIT.enabled? && !mjit_force_enabled? # checking -DMJIT_FORCE_ENABLE + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? && !mjit_force_enabled? # checking -DMJIT_FORCE_ENABLE assert_equal(NO_JIT_DESCRIPTION, r[0]) else assert_equal(RUBY_DESCRIPTION, r[0]) @@ -180,7 +180,7 @@ class TestRubyOptions < Test::Unit::TestCase def test_version assert_in_out_err(%w(--version)) do |r, e| assert_match(VERSION_PATTERN, r[0]) - if RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE assert_equal(EnvUtil.invoke_ruby(['-e', 'print RUBY_DESCRIPTION'], '', true).first, r[0]) else assert_equal(RUBY_DESCRIPTION, r[0]) @@ -210,7 +210,7 @@ class TestRubyOptions < Test::Unit::TestCase ].each do |args| assert_in_out_err(args) do |r, e| assert_match(VERSION_PATTERN_WITH_JIT, r[0]) - if RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE assert_equal(RUBY_DESCRIPTION, r[0]) else assert_equal(EnvUtil.invoke_ruby(['--jit', '-e', 'print RUBY_DESCRIPTION'], '', true).first, r[0]) |