Allow `Coverage.supported?` to recognize oneshot lines mode
Currently in Ruby 3.2.0, Coverage's new
supported? method (introduced in https://bugs.ruby-lang.org/issues/19026) does not recognize support for oneshot lines. Given that it is an available mode of coverage, I'm proposing that
Coverage.supported? report that oneshot lines is supported.
~|⇒ ruby -v ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-darwin22] ~|⇒ irb irb(main):001:0> require "coverage" => true irb(main):002:0> Coverage.supported?(:lines) => true irb(main):003:0> Coverage.supported?(:oneshot_lines) => false
Updated by ioquatix (Samuel Williams) 30 days ago
I basically agree with fixing this - can you link the PR?
The only feedback I have is that
:oneshot_lines are basically the same from a compatibility POV. I wonder if the flags should actually be
:lines | :oneshot. Because other forms of coverage might also want to be oneshot?
@mame (Yusuke Endoh) what do you think?
Updated by mame (Yusuke Endoh) 30 days ago
TBH, I don't fully understand the need for
Coverage.supported?. (I thought
RUBY_VERSION > "3.1" was good enough as I said in https://bugs.ruby-lang.org/issues/19026#note-6.) So I am not sure of the need for
Coverage.supported?(:oneshot_lines) either. In any case, since it is already in place, I don't see a problem with introducing more