Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single line conditionals: line coverage #386

Closed
Kriechi opened this issue May 4, 2015 · 4 comments
Closed

Single line conditionals: line coverage #386

Kriechi opened this issue May 4, 2015 · 4 comments

Comments

@Kriechi
Copy link

Kriechi commented May 4, 2015

Is it possible to correctly determine the coverage for a single line conditional, e.g.:

foo if bar.present?

As far as I can see this line would be marked as green as soon as the conditional is evaluated, even if it evaluates to false and therefore does not execute the foo statement.
This means that the coverage information about the single foo call is lost.
Ideally the html formatter could split the line somehow to indicate that only the conditional is covered, but not the actual statement.

Is this possible?
Thanks.

@colszowka
Copy link
Collaborator

Unfotunately, this is not possible because the underlying ruby Coverage library used by simplecov does not support reporting this kind of data (branch/condition coverage). Sorry to dissapoint!

@joevandyk
Copy link

Is this still the case with Ruby >= 2.5?

https://bugs.ruby-lang.org/issues/13901

@bf4
Copy link
Collaborator

bf4 commented Aug 30, 2019

@joevandyk yes, there's an issue for that.

@simplecov-ruby simplecov-ruby locked as resolved and limited conversation to collaborators Aug 30, 2019
@PragTob
Copy link
Collaborator

PragTob commented Aug 31, 2019

@joevandyk there's an open PR even #694

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants