Skip to content

fail_on_revert does not fail test suite when revert happens inside handler function #5726

@Rubilmax

Description

@Rubilmax

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 (95a93cd 2023-08-25T00:25:25.985662923Z)

What command(s) is the bug in?

forge test

Operating System

None

Describe the bug

The following test passes:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "forge-std/Test.sol";

contract BrokenInvariantTest is Test {
    bytes4[] internal selectors;

    function setUp() public {
        selectors.push(this.doSomething.selector);

        targetSelector(FuzzSelector({addr: address(this), selectors: selectors}));
    }

    function doSomething() public {
        require(false);
    }

    function invariantBroken() public {}
}

using the command: forge test

Expected behavior would be: the test suite fails because there's a revert in a handler function

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions