Skip to content

Commit

Permalink
feat: count assertions for expectEmit (#640)
Browse files Browse the repository at this point in the history
Ref: foundry-rs/foundry#9405

Adds the following cheatcodes to the interface:

```solidity
    /// Expect a given number of logs with the provided topics.
    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, uint64 count) external;

    /// Expect a given number of logs from a specific emitter with the provided topics.
    function expectEmit(
        bool checkTopic1,
        bool checkTopic2,
        bool checkTopic3,
        bool checkData,
        address emitter,
        uint64 count
    ) external;

    /// Expect a given number of logs with all topic and data checks enabled.
    function expectEmit(uint64 count) external;

    /// Expect a given number of logs from a specific emitter with all topic and data checks enabled.
    function expectEmit(address emitter, uint64 count) external;
  • Loading branch information
yash-atreya authored Dec 17, 2024
1 parent d3db4ef commit 5f1b1c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/Vm.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/Vm.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Vm, VmSafe} from "../src/Vm.sol";
// added to or removed from Vm or VmSafe.
contract VmTest is Test {
function test_VmInterfaceId() public pure {
assertEq(type(Vm).interfaceId, bytes4(0xbe425eb2), "Vm");
assertEq(type(Vm).interfaceId, bytes4(0xdb28dd7b), "Vm");
}

function test_VmSafeInterfaceId() public pure {
Expand Down

0 comments on commit 5f1b1c6

Please sign in to comment.