* test/coverage/test_coverage.rb: Added test-case for Coverage.restart.

[Misc #11732][ruby-dev:49379]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2015-11-26 00:51:03 +00:00
Родитель a4ac506551
Коммит 676c80d203
2 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Nov 26 09:50:02 2015 yui-knk <spiketeika@gmail.com>
* test/coverage/test_coverage.rb: Added test-case for Coverage.restart.
[Misc #11732][ruby-dev:49379]
Thu Nov 26 09:46:36 2015 yui-knk <spiketeika@gmail.com>
* test/coverage/test_coverage.rb: Added test-case for Coverage.peek_result

Просмотреть файл

@ -60,12 +60,30 @@ class TestCoverage < Test::Unit::TestCase
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