Skip to content

Latest commit

 

History

History
73 lines (54 loc) · 2.29 KB

foundry-test-functions.md

File metadata and controls

73 lines (54 loc) · 2.29 KB
warning layout title
This is a dynamically generated file. Do not edit manually.
default
foundry-test-functions | Solhint

foundry-test-functions

Category Badge Default Severity Badge warn

Description

Enforce naming convention on functions for Foundry test cases

Options

This rule accepts an array of options:

Index Description Default Value
0 Rule severity. Must be one of "error", "warn", "off". warn

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. setUp function 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 external and public functions
  • 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

Resources