Skip to content

Commit 73a504d

Browse files
PaulRBergmds1
andauthored
feat: add simple "expectEmit" (#320)
* feat: add simple "expectEmit" * style: forge fmt --------- Co-authored-by: Matt Solomon <[email protected]>
1 parent dc1901f commit 73a504d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Vm.sol

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,22 @@ interface Vm is VmSafe {
326326
function expectRevert(bytes calldata revertData) external;
327327
function expectRevert(bytes4 revertData) external;
328328
function expectRevert() external;
329+
330+
// Prepare an expected log with all four checks enabled.
331+
// Call this function, then emit an event, then call a function. Internally after the call, we check if
332+
// logs were emitted in the expected order with the expected topics and data.
333+
// Second form also checks supplied address against emitting contract.
334+
function expectEmit() external;
335+
function expectEmit(address) external;
336+
329337
// Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData).
330338
// Call this function, then emit an event, then call a function. Internally after the call, we check if
331-
// logs were emitted in the expected order with the expected topics and data (as specified by the booleans)
339+
// logs were emitted in the expected order with the expected topics and data (as specified by the booleans).
340+
// Second form also checks supplied address against emitting contract.
332341
function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;
333342
function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)
334343
external;
344+
335345
// Mocks a call to an address, returning specified data.
336346
// Calldata can either be strict or a partial match, e.g. if you only
337347
// pass a Solidity selector to the expected calldata, then the entire Solidity

0 commit comments

Comments
 (0)