summaryrefslogtreecommitdiff
path: root/test/coverage
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-04 15:55:06 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-04 15:55:06 +0000
commitea8b916307b739798a1710c4443677c5e0bf314a (patch)
treed970839f27f5a00d015f4a65447ebfc495d1fc66 /test/coverage
parente6d42f34e2cbd2c6a9133d4e972ceda58af43bc0 (diff)
* ext/coverage/coverage.c: resurrect r32071 + add GC guard for
rb_coverages. [ruby-core:37352] [Bug #4927] [ruby-core:36539] [Feature #4796] * test/coverage/test_coverage.rb resurrect r32071. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/coverage')
-rw-r--r--test/coverage/test_coverage.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index d5091f3..56966b1 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -15,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