diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-02 16:46:08 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-02 16:46:08 +0000 |
commit | f6f769d26d8ba3fa715cbb0e3717ff50207befaa (patch) | |
tree | 9cff0df9f64c2b1df9d48b7c6de96335944a17a9 /test/ruby/test_backtrace.rb | |
parent | 0d1b2164b01bc54b5cced5c9d96349661af55242 (diff) |
* 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
Diffstat (limited to 'test/ruby/test_backtrace.rb')
-rw-r--r-- | test/ruby/test_backtrace.rb | 22 |
1 files changed, 15 insertions, 7 deletions
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 |