mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 06:25:31 +02:00
RubyVM::InstructionSequence.of Thread::Backtrace::Location
This would be useful for debugging.
This commit is contained in:
parent
78fb1ab84b
commit
5eca11ca5e
Notes:
git
2024-10-16 18:31:45 +00:00
2 changed files with 16 additions and 7 deletions
|
@ -726,18 +726,24 @@ class TestISeq < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_iseq_of
|
||||
[proc{},
|
||||
method(:test_iseq_of),
|
||||
RubyVM::InstructionSequence.compile("p 1", __FILE__)].each{|src|
|
||||
[
|
||||
proc{},
|
||||
method(:test_iseq_of),
|
||||
RubyVM::InstructionSequence.compile("p 1", __FILE__),
|
||||
begin; raise "error"; rescue => error; error.backtrace_locations[0]; end
|
||||
].each{|src|
|
||||
iseq = RubyVM::InstructionSequence.of(src)
|
||||
assert_equal __FILE__, iseq.path
|
||||
}
|
||||
end
|
||||
|
||||
def test_iseq_of_twice_for_same_code
|
||||
[proc{},
|
||||
method(:test_iseq_of_twice_for_same_code),
|
||||
RubyVM::InstructionSequence.compile("p 1")].each{|src|
|
||||
[
|
||||
proc{},
|
||||
method(:test_iseq_of_twice_for_same_code),
|
||||
RubyVM::InstructionSequence.compile("p 1"),
|
||||
begin; raise "error"; rescue => error; error.backtrace_locations[0]; end
|
||||
].each{|src|
|
||||
iseq1 = RubyVM::InstructionSequence.of(src)
|
||||
iseq2 = RubyVM::InstructionSequence.of(src)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue