Skip to content

Forge doesn't work with multiple "vm.expectRevert" when testing free functions #3723

@PaulRBerg

Description

@PaulRBerg

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (cb925b1 2022-11-21T00:09:19.970948Z)

What command(s) is the bug in?

forge test

Operating System

macOS (Apple Silicon)

Describe the bug

Given the following test:

function testMultipleReverts() public {
    vm.expectRevert();
    revert();

    vm.expectRevert();
    console2.log("Do not revert");
}

Forge will consider the test to be passed, even if it should be failed, because there is no second revert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions