From: "ioquatix (Samuel Williams)" Date: 2022-09-23T22:58:54+00:00 Subject: [ruby-core:110052] [Ruby master Feature#19008] Introduce coverage support for `eval`. Issue #19008 has been updated by ioquatix (Samuel Williams). @jeremyevans0 now I understand your motivation. To summarise: - Coverage is always going to be imprecise. - More precise coverage can be useful, like branch coverage, etc, because we can see whether specific lexical logic is tested or not. - We already get validation of all lexical execution via this PR, i.e. line coverage of eval blocks. - Your proposal gives us separate coverage for separate dynamically defined methods/attributes/etc, on the same lines (so no improvement on lexical coverage). Here are the issues as I see them: 1. There is no user-facing flag which we can use to detect this feature. e.g. `Coverage::SUPPORTED = [:lines, :branches, :methods, :oneshot_lines, :eval]` or something. @mame can :oneshot_lines be used as the same time as :lines or are they mutually exclusive? 2. Introduce a flag to switch this feature on and off. e.g. `Coverage.start(eval: true/false)`. I am okay with introducing this if there is a strong desire for it. However, I think the normal `Coverage.start(:all)` should default to true for eval. 3. Introduce eval key as per @jeremyevans0's request. I think introducing (2) is reasonable given everything else supports this style, but the default is to enable `:all` as per the documentation. Let me check how complex it is to add a new flag. The other issues probably need separate feature requests. ---------------------------------------- Feature #19008: Introduce coverage support for `eval`. https://bugs.ruby-lang.org/issues/19008#change-99303 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal ---------------------------------------- I'd like to introduce coverage support for `eval`. I mostly only care about the case where an explicit path is given, and I'd even be okay to only handle the case where the line number is the default (0). https://github.com/ruby/ruby/pull/6396 This is an incredibly useful feature for computing coverage of ERB templates and other similar things. -- https://bugs.ruby-lang.org/ Unsubscribe: