foundry-test-functions
September 16, 2025 ยท View on GitHub
Description
Enforce naming convention on functions for Foundry test cases (DEPRECATED, use foundry-test-functions-naming)
Options
This rule accepts an array of options:
| Index | Description | Default Value |
|---|---|---|
| 0 | Rule severity. Must be one of "error", "warn", "off". | warn |
| 1 | Array of required Foundry test hook function names. | setUp |
Example Config
{
"rules": {
"foundry-test-functions": [
"warn",
[
"setUp"
]
]
}
}
Notes
- This rule can be configured to skip certain function names in the SKIP array. In Example Config.
setUpfunction will be skipped - Supported Regex:
test(Fork)?(Fuzz)?(Fail)?_(Revert(If_|When_){1})?\w{1,} - This rule should be executed in a separate folder with a separate .solhint.json =>
solhint --config .solhint.json testFolder/**/*.sol - This rule applies only to
externalandpublicfunctions - This rule skips the
setUp()function by default
Examples
๐ Examples of correct code for this rule
Foundry test case with correct Function declaration
function test_NumberIs42() public {}
Foundry test case with correct Function declaration
function testFail_Subtract43() public {}
Foundry test case with correct Function declaration
function testFuzz_FuzzyTest() public {}
๐ Examples of incorrect code for this rule
Foundry test case with incorrect Function declaration
function numberIs42() public {}
Version
This rule was introduced in Solhint 3.6.1