-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Coverage doesn't cover internal libs when passing implicit storage vars via the using
syntax
#4854
Comments
@gretzke for visibility |
The workaround of calling the library directly once also only works once. If you have a second internal library in the same contract you can call it directly as often as you want, it won't show up in the coverage report as covered. This does not seem to be connected to the |
having similar issue with using for directive on custom types |
I think I have the similar issue by using the what it doesn't work is:
what's my work around is:
|
I am having the same issue, but interestingly I don't get 0 coverage, only partial coverage, even though all lines are being touched by my tests. |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (8f246e0 2023-04-28T00:14:27.758082000Z)
What command(s) is the bug in?
forge coverage --report lcov && genhtml -o forge-coverage lcov.info
Operating System
macOS (Apple Silicon)
Describe the bug
When importing an internal lib and utilizing it with the
using
syntax, coverage does not detect any hits on the functions in the library.Example is shown below (some code omitted for brevity):
Yields the following coverage report:
However, if I change the syntax of how the library function is called, where the storage variable isn't implicitly passed as the first argument, the coverage is correct.
Then coverage report is accurate:
Another important piece of information to add is that calling the Library function explicitly just once, ie the remainder of the
_stakes.addStake(...)
and any additional library calls to any/all functions using the implicit syntax are now covered.The text was updated successfully, but these errors were encountered: