Project

General

Profile

Misc #11732 » 0001-Add-a-test-case-for-test_restarting_coverage.patch

yui-knk (Kaneko Yuichiro), 11/23/2015 11:03 AM

View differences:

test/coverage/test_coverage.rb
EOS
end
File.open("test2.rb", "w") do |f|
f.puts <<-EOS
def coverage_test_method2
:ok
:ok
end
EOS
end
Coverage.start
require tmp + '/test.rb'
assert_equal 3, Coverage.result[tmp + '/test.rb'].size
# Restart coverage but '/test.rb' is required before restart,
# so coverage is not recorded.
Coverage.start
coverage_test_method
assert_equal 0, Coverage.result[tmp + '/test.rb'].size
# Restart coverage and '/test2.rb' is required after restart,
# so coverage is recorded.
Coverage.start
require tmp + '/test2.rb'
assert_equal 4, Coverage.result[tmp + '/test2.rb'].size
}
}
ensure
    (1-1/1)