From: "mame (Yusuke Endoh)" Date: 2022-09-28T18:06:03+00:00 Subject: [ruby-core:110135] [Ruby master Bug#19026] Add `Coverage.supported?(x)` to detect support for `eval` coverage flag. Issue #19026 has been updated by mame (Yusuke Endoh). Dan0042 (Daniel DeLorme) wrote in #note-4: > Isn't there a general mechanism for feature support? Like `RbConfig.support?(:eval_coverage)` or something? I don't think it makes sense because this doesn't change depending on the ruby config. jeremyevans0 (Jeremy Evans) wrote in #note-5: > I think having `Coverage.supported?` return true when it is supported is fine. However, it would be useful to have an API such as `Coverage.activated?` that only returns true when the specific coverage feature is currently enabled. Thank you for your comment. @ioquatix didn't write the use case. He wants to use his own coverage measurement based on TracePoint if "coverage for eval" feature is not supported (i.e., in Ruby 3.1 or before). TBH I am not sure if this is a common use case. @ioquatix isn't `RUBY_VERSION > "3.1"` enough for your case? I am not so positive to have `Coverage.activated?(:eval or something)` because I don't allow users to write code that changes behavior depending on whether/which coverage is enabled or not. But we already have `Coverage.running?`, so I am okay if there is a common use case for `Coverage.activated?`. ---------------------------------------- Bug #19026: Add `Coverage.supported?(x)` to detect support for `eval` coverage flag. https://bugs.ruby-lang.org/issues/19026#change-99394 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Introduce the following interface: ``` Coverage.supported?(eval) -> true/false ``` We can also check `lines` `branches` and `methods`? -- https://bugs.ruby-lang.org/ Unsubscribe: