Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

StdAssertions fail function has no parameter #1383

Open
tuncatunc opened this issue Jan 9, 2025 · 0 comments
Open

StdAssertions fail function has no parameter #1383

tuncatunc opened this issue Jan 9, 2025 · 0 comments

Comments

@tuncatunc
Copy link
Contributor

Hi All,

forge-std@1.9.4 library StdAssertions fail function has no string parameter as opposed mentioned in the document.

https://book.getfoundry.sh/reference/forge-std/fail?highlight=fail#fail

// SPDX-License-Identifier: MIT

pragma solidity 0.8.24;

contract MyContract is Test {
    function testShouldFail() external {
        fail("Random test failed");
    }
}
➜  foundry-contracts git:(main) ✗ forge build
[⠊] Compiling...
[⠑] Compiling 11 files with Solc 0.8.24
[⠘] Solc 0.8.24 finished in 631.44ms
Error: Compiler run failed:
Error (6160): Wrong argument count for function call: 1 arguments given but expected 0.
   --> test/CampaignManager.t.sol:338:9:
    |
338 |         fail(failMessage);
    |         ^^^^^^^^^^^^^^^^^
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
No open projects
Status: No status
Development

No branches or pull requests

1 participant