foundry: `forge coverage` does not work for if statements within for loops

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (70f4fb5 2022-11-03T00:06:25.653195Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Apple Silicon)

Describe the bug

When I run forge coverage to test the coverage for my code, I found that I have written the code to match the all branches but the result seems not. If I call the external function, it will not cover this branch. 截屏2022-11-03 下午5 00 14

The coverage result is 截屏2022-11-03 下午5 03 07

But I think my test function have covered all situations, and the result is not

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 3
  • Comments: 18 (11 by maintainers)

Most upvoted comments

No, @deboguer-jng. Also, I have never been involved in the development of the forge coverage command - I am just a user like you.

No worries, @KittyFu307. Pinging @onbjerg in case he could take a quick look? Seems like an easy fix.

@KittyFu307 it may be useful to rename the title of this issue to include a reference to for loops so that other users who bump into the same problem can reach us here.

Sure~ have already done

Hi @rkrasiuk any update for this issue? Thank you for your time