summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-01 14:58:52 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-01 14:58:52 +0000
commit95d949d5717301fec39b8b2e5b817b64761afdf1 (patch)
treed9654f0a108b7002a815bf2137a6782de52cf798 /test
parent3d46d51c45b608000d1de02fffa80f0901959e67 (diff)
ext/coverage/coverage.c: add Coverage.enabled?
* ext/coverage/coverage.c (rb_coverage_running): add to quickly check if coverage is enabled. patched by Burke Libbey <burke AT libbey.me> in [ruby-core:81726]. [Feature #13667] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/coverage/test_coverage.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index b039213..58b9428 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -23,6 +23,16 @@ class TestCoverage < Test::Unit::TestCase
end
end
+ def test_coverage_running?
+ refute Coverage.running?
+ Coverage.start
+ assert Coverage.running?
+ Coverage.peek_result
+ assert Coverage.running?
+ Coverage.result
+ refute Coverage.running?
+ end
+
def test_coverage_snapshot
loaded_features = $".dup