diff options
author | Charles Oliver Nutter <headius@headius.com> | 2020-02-23 12:49:26 -0800 |
---|---|---|
committer | Charles Oliver Nutter <headius@headius.com> | 2020-03-03 08:42:25 -0600 |
commit | 03f9e8746e42a4835583678af217cdf4c417bd05 (patch) | |
tree | 5545e3a10b62dc474fe3f187152b6b42eaab6f26 /test | |
parent | 43ed4eb6d1cbbd31de2c98ae515630ee8f988c1e (diff) | |
download | ruby-03f9e8746e42a4835583678af217cdf4c417bd05.tar.gz |
Don't tweak RubyVM compile options if it's not defined
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_settracefunc.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 73cf625258..300033ae7e 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -3,17 +3,21 @@ require 'test/unit' class TestSetTraceFunc < Test::Unit::TestCase def setup - @original_compile_option = RubyVM::InstructionSequence.compile_option - RubyVM::InstructionSequence.compile_option = { - :trace_instruction => true, - :specialized_instruction => false - } + if defined?(RubyVM) + @original_compile_option = RubyVM::InstructionSequence.compile_option + RubyVM::InstructionSequence.compile_option = { + :trace_instruction => true, + :specialized_instruction => false + } + end @target_thread = Thread.current end def teardown set_trace_func(nil) - RubyVM::InstructionSequence.compile_option = @original_compile_option + if defined?(RubyVM) + RubyVM::InstructionSequence.compile_option = @original_compile_option + end @target_thread = nil end |