-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(
cheatcodes
): return early in case of reverts to not conflict wi…
…th expect* logic (#6172) * feat: return early in case of reverts to not conflict with expect* logic * chore: move diagnose revert logic * add test
- Loading branch information
Showing
3 changed files
with
78 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity 0.8.18; | ||
|
||
import "ds-test/test.sol"; | ||
import "../cheats/Vm.sol"; | ||
|
||
contract Emitter { | ||
event Values(uint256 indexed a, uint256 indexed b); | ||
|
||
function plsEmit(uint256 a, uint256 b) external { | ||
emit Values(a, b); | ||
} | ||
} | ||
|
||
// https://github.com/foundry-rs/foundry/issues/6170 | ||
contract Issue6170Test is DSTest { | ||
Vm constant vm = Vm(HEVM_ADDRESS); | ||
|
||
event Values(uint256 indexed a, uint256 b); | ||
|
||
Emitter e = new Emitter(); | ||
|
||
function test() public { | ||
vm.expectEmit(true, true, false, true); | ||
emit Values(69, 420); | ||
e.plsEmit(69, 420); | ||
} | ||
} |