-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add skip cheatcode docs (#938)
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## `skip` | ||
|
||
## Signature | ||
|
||
```solidity | ||
function skip(bool skip) external; | ||
``` | ||
|
||
## Description | ||
|
||
Marks a test as skipped, conditionally. It must be called at the top of the test to ensure it is skipped without any execution. | ||
|
||
If `skip` is called with a false boolean, it will not skip the test. | ||
|
||
Tests marked as skipped will appear with a `[SKIPPED]` label on the test runner and on the summary, to easily identify skipped tests. | ||
|
||
### Examples | ||
|
||
```solidity | ||
function testSkip() public { | ||
cheats.skip(true); | ||
/// This revert will not be reached as this test will be skipped. | ||
revert("Should not reach this revert"); | ||
} | ||
function testNotSkip() public { | ||
cheats.skip(false); | ||
/// This revert will be reached as this test will not be skipped, and the test will fail. | ||
revert("Should reach this revert"); | ||
} | ||
``` |