Skip to content

Case statements should be counted as branches #493

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

Merged
merged 2 commits into from
Aug 3, 2022
Merged

Case statements should be counted as branches #493

merged 2 commits into from
Aug 3, 2022

Conversation

jrglee
Copy link
Contributor

@jrglee jrglee commented Aug 3, 2022

The readme mentions that branch coverage includes if/else, pattern matching, partial functions and try/catch/finally. But currently, it only supports if/else and try/catch/finally. All the case statements are not covered as branches. This means pattern matching, partial functions, catch blocks and any ad-hoc match statement that functionally acts as an if/else block.

This change follows what was done in the early versions of the repo and instruments the case statements as branches. Since case statements are also used as sentinels, it is necessary to parameterize the transformCases helper to distinguish when to actually instrument with branching or not.

This addresses #96 which has been open for quite a while already.

Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the pr @jrglee. Looks good, LGTM

@ckipp01 ckipp01 merged commit a6dc5c0 into scoverage:main Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants