1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/coverage/test_coverage.rb: add a test for restart. a patch

from Xavier Shay.  [ruby-core:36745]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2011-06-13 16:12:52 +00:00
parent 7023a64d80
commit 1d147fb24c
2 changed files with 31 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Tue Jun 14 01:10:38 2011 Yusuke Endoh <mame@tsg.ne.jp>
* test/coverage/test_coverage.rb: add a test for restart. a patch
from Xavier Shay. [ruby-core:36745]
Tue Jun 14 01:05:10 2011 Yusuke Endoh <mame@tsg.ne.jp>
* ext/coverage/coverage.c: make it restartable. [ruby-core:36539]

View file

@ -1,5 +1,6 @@
require "test/unit"
require "coverage"
require "tmpdir"
class TestCoverage < Test::Unit::TestCase
def test_result_without_start
@ -14,4 +15,29 @@ class TestCoverage < Test::Unit::TestCase
assert_kind_of(Array, val)
end
end
def test_restarting_coverage
loaded_features = $".dup
Dir.mktmpdir {|tmp|
Dir.chdir(tmp) {
File.open("test.rb", "w") do |f|
f.puts <<-EOS
def coverage_test_method
:ok
end
EOS
end
Coverage.start
require tmp + '/test.rb'
Coverage.result
Coverage.start
coverage_test_method
assert_equal 1, Coverage.result.size
}
}
ensure
$".replace loaded_features
end
end