From b3d330c39ebbf27cefc2d83109dad9e0b3b0e94f Mon Sep 17 00:00:00 2001 From: Kevin Murphy Date: Thu, 29 Dec 2022 03:23:25 -0500 Subject: [PATCH] Coverage.supported? recognizes oneshot_lines mode (#7040) This adds oneshot_lines as a mode of coverage that is supported. --- ext/coverage/coverage.c | 3 ++- test/coverage/test_coverage.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c index 4578de54e4..399e28cdab 100644 --- a/ext/coverage/coverage.c +++ b/ext/coverage/coverage.c @@ -29,7 +29,7 @@ static VALUE me2counter = Qnil; * Returns true if coverage measurement is supported for the given mode. * * The mode should be one of the following symbols: - * +:lines+, +:branches+, +:methods+, +:eval+. + * +:lines+, +:oneshot_lines+, +:branches+, +:methods+, +:eval+. * * Example: * @@ -43,6 +43,7 @@ rb_coverage_supported(VALUE self, VALUE _mode) return RBOOL( mode == rb_intern("lines") || + mode == rb_intern("oneshot_lines") || mode == rb_intern("branches") || mode == rb_intern("methods") || mode == rb_intern("eval") diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb index a2a7718a30..d5334d07a5 100644 --- a/test/coverage/test_coverage.rb +++ b/test/coverage/test_coverage.rb @@ -174,6 +174,7 @@ class TestCoverage < Test::Unit::TestCase def test_coverage_supported assert Coverage.supported?(:lines) + assert Coverage.supported?(:oneshot_lines) assert Coverage.supported?(:branches) assert Coverage.supported?(:methods) assert Coverage.supported?(:eval)