Improved support for foundry tests#1499
Conversation
|
@BowTiedRadone do you want to own this PR? We need to add some test integration with Foundry so we can verify we are catching correctly the failures (at least, for stateless tests) |
|
@gustavo-grieco Sure! Thanks. |
* Fix fallback function bug in Foundry test generation * Fix null byte in argument bug in Foundry test generation * Remove unnecessary config file * Remove unused/redundant imports * Disable Slither in Foundry test gen tests * Conditionally run forge-std tests based on the solc version * Reduce unnecessary test grouping and improve failed assertion messages --------- Co-authored-by: Emilio López <[email protected]>
* Rename dapptest to foundry and support foundry assertX in assertion mode * Rename basic foundry test contracts dir to `foundry-basic` * Add testing modes to `README`
| unlimitedGasPerBlock | ||
| (0, 0) | ||
| vm4 <- if isDapptestMode solConf.testMode && setUpFunction `elem` abi | ||
| vm4 <- if is_testFunction `elem` abi && setUpFunction `elem` abi |
There was a problem hiding this comment.
is this intentional? if so, we should document that setUp() gets called on all test modes if the contract has an IS_TEST.
There was a problem hiding this comment.
This seems intentional. The change from isDapptestMode to checking IS_TEST() means any contract following the Foundry convention gets setUp() called regardless of test mode. To me this sound like better behavior since a contract with IS_TEST() likely expects its setUp() to run even in assertion or property mode. @gustavo-grieco please correct me if my understanding is wrong.
There was a problem hiding this comment.
Yeap, let's add an IS_TEST guard, if we are using foundry, it makes sense to run that. Watch for our tests.
There was a problem hiding this comment.
Fixed, let's check the CI ..
Foundry tests should be able to be used, as much as possible. In particular, we could re-use all the test infrastructure, for stateless tests. We want to eventually reach some decent level of compatibility.