diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-04-17 16:03:05 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-04-17 18:47:07 +0900 |
commit | 09638741ba4d9547a0e48af8c767744fb1d7f68d (patch) | |
tree | 9fc723c63d3594e0b420d14fc7d9e876ab073125 /test/ruby | |
parent | 7bc66a366ded3ae2d07a418e17a9da6ee24612fd (diff) |
[Feature #20335] `Thread.each_caller_location` arguments
Accecpt the same arguments as `caller` and `caller_locations`.
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_backtrace.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb index cfc65faacb..fca7b62030 100644 --- a/test/ruby/test_backtrace.rb +++ b/test/ruby/test_backtrace.rb @@ -155,6 +155,10 @@ class TestBacktrace < Test::Unit::TestCase end def test_each_backtrace_location + assert_nil(Thread.each_caller_location {}) + + assert_raise(LocalJumpError) {Thread.each_caller_location} + i = 0 cl = caller_locations(1, 1)[0]; ecl = Thread.each_caller_location{|x| i+=1; break x if i == 1} assert_equal(cl.to_s, ecl.to_s) @@ -181,6 +185,10 @@ class TestBacktrace < Test::Unit::TestCase assert_raise(StopIteration) { ecl.next } + + ary = [] + cl = caller_locations(1, 2); Thread.each_caller_location(1, 2) {|x| ary << x} + assert_equal(cl.map(&:to_s), ary.map(&:to_s)) end def test_caller_locations_first_label |