-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
A-cheatcodesArea: cheatcodesArea: cheatcodesC-forgeCommand: forgeCommand: forgeCmd-forge-testCommand: forge testCommand: forge test
Milestone
Description
Is it expected that this test should pass?
foundry/testdata/default/cheats/ExpectRevert.t.sol
Lines 99 to 103 in c3e58d4
function testShouldFailIfExpectRevertWrongString() public { | |
Reverter reverter = new Reverter(); | |
vm.expectRevert("my not so cool error", 0); | |
reverter.revertWithMessage("my cool error"); | |
} |
Perhaps it was an error in #9574? It doesn't seem like the intention of the original test:
foundry/testdata/cheats/ExpectRevert.t.sol
Lines 83 to 87 in daefe5e
function testFailExpectRevertWrongString() public { | |
Reverter reverter = new Reverter(); | |
vm.expectRevert("my not so cool error"); | |
reverter.revertWithMessage("my cool error"); | |
} |
What seems to be happening is expectRevert
with count = 0
allows non-matching reverts because it just checks the count of matching reverts. This was not intuitive to me.
Allowing count = 0
seems error prone, I'm not sure it would be legitimate in any context.
Metadata
Metadata
Assignees
Labels
A-cheatcodesArea: cheatcodesArea: cheatcodesC-forgeCommand: forgeCommand: forgeCmd-forge-testCommand: forge testCommand: forge test
Type
Projects
Status
Completed