-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
bug(forge): empty if/else statements are not covered #4314
Comments
Able to reproduce the bug, now yields
|
@PaulRBerg we added several improvements for if/else coverage (see #8414) , however this is an edge case that would add complexity in code (and not fully justified IMO). Besides that, having coverage reporting such leftovers should be of benefit for code quality (forcing devs to remove such useless code). |
Makes sense! |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (249538f 2023-02-08T00:12:05.805004Z)
What command(s) is the bug in?
forge coverage
Operating System
macOS (Apple Silicon)
Describe the bug
Describe the bug
The
forge coverage
command does not cover empty if/ else statements.Reproduction Steps
Take the following contract:
And the following tests:
Now, run
forge coverage
. You will get this report:Notice that the coverage is 0% instead of 100%, even if the if/else statement is technically covered as part of the execution of the
coverMe
function.This bug applies even if the
else
is removed.The text was updated successfully, but these errors were encountered: