mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ext/coverage/lib/coverage.rb (Coverage.line_stub): use only line events
It wrongly used all linenos of ISeq#trace_points which includes not only line events but also call, return, and other events. So, the result included some linenos that can not be covered at all by line coverage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1d13610d8a
commit
ab2da43ce4
2 changed files with 2 additions and 2 deletions
|
@ -6,7 +6,7 @@ module Coverage
|
|||
iseqs = [RubyVM::InstructionSequence.compile_file(file)]
|
||||
until iseqs.empty?
|
||||
iseq = iseqs.pop
|
||||
iseq.trace_points.each {|n, _| lines[n - 1] = 0 }
|
||||
iseq.trace_points.each {|n, type| lines[n - 1] = 0 if type == :line }
|
||||
iseq.each_child {|child| iseqs << child }
|
||||
end
|
||||
lines
|
||||
|
|
|
@ -671,7 +671,7 @@ class TestCoverage < Test::Unit::TestCase
|
|||
f.puts "end"
|
||||
end
|
||||
|
||||
assert_equal([0, 0, 0, nil, 0, nil, 0], Coverage.line_stub("test.rb"))
|
||||
assert_equal([0, 0, 0, nil, 0, nil, nil], Coverage.line_stub("test.rb"))
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue