-
If I have a function in my contract
In hardhat I am able to write a test which can assert which of the require messages caused the failure, something like:
But I've found no way to accomplish the same with Foundry, I can only detect whether a revert happens not why. Is there a way to do this? It shows up in the logs when the tests fail so I'm sure there must be a way:
|
Beta Was this translation helpful? Give feedback.
Answered by
odyslam
Jun 2, 2022
Replies: 1 comment 1 reply
-
vm.expectRevert("revertString"); will make sure to catch require(false, "revertString") or revert("revertString") |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
AlexDiru
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vm.expectRevert("revertString");
will make sure to catch require(false, "revertString") or revert("revertString")