ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "mame (Yusuke Endoh)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:110135] [Ruby master Bug#19026] Add `Coverage.supported?(x)` to detect support for `eval` coverage flag.
Date: Wed, 28 Sep 2022 18:06:03 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-99394.20220928180603.3344@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-19026.20220928105240.3344@ruby-lang.org

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/

  parent reply	other threads:[~2022-09-28 18:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 10:52 [ruby-core:110119] [Ruby master Bug#19026] Add `Coverage.supported?(x)` to detect support for `eval` coverage flag ioquatix (Samuel Williams)
2022-09-28 11:01 ` [ruby-core:110120] " mame (Yusuke Endoh)
2022-09-28 11:09 ` [ruby-core:110121] " ioquatix (Samuel Williams)
2022-09-28 14:18 ` [ruby-core:110124] " mame (Yusuke Endoh)
2022-09-28 14:55 ` [ruby-core:110128] " Dan0042 (Daniel DeLorme)
2022-09-28 15:03 ` [ruby-core:110129] " jeremyevans0 (Jeremy Evans)
2022-09-28 18:06 ` mame (Yusuke Endoh) [this message]
2022-09-28 19:22 ` [ruby-core:110139] " Eregon (Benoit Daloze)
2022-09-28 19:43 ` [ruby-core:110140] " Dan0042 (Daniel DeLorme)
2022-09-28 20:46 ` [ruby-core:110141] " ioquatix (Samuel Williams)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-99394.20220928180603.3344@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).