summaryrefslogtreecommitdiff
path: root/test/coverage/test_coverage.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-26 00:51:03 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-26 00:51:03 +0000
commit676c80d203da1d5c2feee44bbe4bc40350b612d4 (patch)
treec3c520fd3ac1bb8e3cba31f7f2f4572a020abb9c /test/coverage/test_coverage.rb
parenta4ac5065519b023e1b951b8891aa71836b88411d (diff)
* 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
Diffstat (limited to 'test/coverage/test_coverage.rb')
-rw-r--r--test/coverage/test_coverage.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index 549793b..b7a7ea7 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -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