close

Project

General

Profile

Actions

Feature #22014

open
Image

Support `||` and `&&` operations in coverage

Feature #22014: Support `||` and `&&` operations in coverage
1

Added by G-Rath (Gareth Jones) 5 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:125343]

Description

https://bugs.ruby-lang.org/issues/13901 added support for branch coverage, but did not include || and && branches

i.e.

def self.even_and_positive(number)
  number.even? && number >= 0
end

Currently, this is considered to be 100% covered so long as it is executed, even though some values won't result in the right hand check being executed.

From the comments on the original ticket, it sounds like || and && were planned to be supported:

https://bugs.ruby-lang.org/issues/13901?tab=history#note-6
marcandre:
I imagine you are planning on covering ||, &&, &. and ? :, right?

https://bugs.ruby-lang.org/issues/13901?tab=history#note-7
mame:
? : has been already supported. Yuichiro has experimentally implemented &. coverage. I think we should support || and && too.
(Formerly, I had no intention of supporting them, but Yuichiro implemented column numbers, so now we will be able to do that.)

So I'm hoping this is just something that got forgotten about rather than having a particular unsolved technical challenge.

Related: https://github.com/simplecov-ruby/simplecov/issues/921

No data to display

Actions

Also available in: PDF Atom