Forum: Ruby-core [Open] Restarting Coverage does not produce correct coverage result

2b58ad496ba51216f571697c8181f1e1?d=identicon&s=25 Sean Ferguson (sean_ferguson)
on 2014-02-26 19:42
(Received via mailing list)
Issue #9572 has been reported by Sean Ferguson.

Bug #9572: Restarting Coverage does not produce correct coverage result

* Author: Sean Ferguson
* Status: Open
* Priority: Normal
* Assignee:
* Category: core
* Target version: current: 2.2.0
* ruby -v: uby 2.0.0p353 (2013-11-22 revision 43784)
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
Feature 4796( appears
to have a bug in it.

While the test listed there does pass the following test does not:
require "test/unit"
require "coverage"
require 'tmpdir'
class TestCoverage < Test::Unit::TestCase
  def test_restarting_coverage
    Dir.mktmpdir {|tmp|
      Dir.chdir(tmp) {"test.rb", "w") do |f|
          f.puts <<-EOS
            def coverage_test_method
              puts :ok
        require tmp + '/test.rb'
        result = Coverage.result
        assert_equal 1, result.size
        assert_equal [0, 1, nil], result.first[1] # coverage stats show
an empty array here
It appears that while the coverage is finding the correct files it is
not giving any coverage stats for those files. Knowing this information
would be very helpful in determining test coverage data for individual
test files. I'm not very familiar
with how the coverage library works, but if you can point me at where to
look I can give fixing it a try.


Sean Ferguson
This topic is locked and can not be replied to.