1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Don't tweak RubyVM compile options if it's not defined

This commit is contained in:
Charles Oliver Nutter 2020-02-23 12:49:26 -08:00
parent 43ed4eb6d1
commit 03f9e8746e
No known key found for this signature in database
GPG key ID: 8E26FF248BC7AEAD

View file

@ -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