summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-10-15 10:06:50 -0400
committerKevin Newton <[email protected]>2024-10-16 14:31:26 -0400
commit5eca11ca5e5503e41b7ec81f03e63c59556c038c (patch)
treed3318069ad963bbb4e4bacc9cd457cbc7eff8b97 /test/ruby
parent78fb1ab84b78596fac6a219c66c1d897aba346bb (diff)
RubyVM::InstructionSequence.of Thread::Backtrace::Location
This would be useful for debugging.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11896
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_iseq.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 49aa4c5abd..9eb9c84602 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -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)