From f6f769d26d8ba3fa715cbb0e3717ff50207befaa Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 2 Jun 2012 16:46:08 +0000 Subject: * vm_backtrace.c: change names. (1) Class name: RubyVM::FrameInfo -> RubyVM::Backtrace::Location. (2) Method name: RubyVM::FrameInfo.caller -> Kernel.caller_locations. (3) Instance methods of RubyVM::FrameInfo (RubyVM::Backtrace::Location) (3-1) name -> label (3-2) basename -> base_label (basename is confusing with File.basename) (3-3) line_no -> lineno (We have already similar name File#lineno, commented by kou [ruby-dev:45686]). (3-4) filename -> path. (3-5) filepath -> absolute_path. (3-5) iseq -> removed (we will make other APIs to access iseq and other information of frame for debugging). * test/ruby/test_backtrace.rb: apply above changes. And apply comment from kou [ruby-dev:45686]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_backtrace.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'test/ruby/test_backtrace.rb') diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb index 67a8a97e7a..e603c8ad4d 100644 --- a/test/ruby/test_backtrace.rb +++ b/test/ruby/test_backtrace.rb @@ -85,13 +85,21 @@ class TestBacktrace < Test::Unit::TestCase rec[m] end - def test_caller_frame_info - fis = RubyVM::FrameInfo.caller(0); cs = caller(0) - assert_equal(cs.size, fis.size) - fis.zip(cs).each{|fi, s| - assert_match(/#{fi.name}/, s) - assert_match(/#{fi.filename}/, s) - assert_match(/#{fi.line_no}/, s) + def test_caller_locations + locs = caller_locations(0); cs = caller(0).map{|line| + path, lineno, label_str = line.split(':') + unless label_str + label_str = lineno + lineno = 0 + end + lineno = lineno.to_i + if /in `(.+?)\'/ =~ label_str + label = $1 + else + label = nil + end + [path, lineno, label] } + assert_equal(locs.map{|loc| [loc.path, loc.lineno, loc.label]}, cs) end end -- cgit v1.2.3