Expand description
The Forge test runner.
Structsยง
- Contract
Runner - A type that executes all tests of a contract
- Contract
Runner ๐Context - Function
Runner ๐ - Executes a single test function, returning a
TestResult. - Invariant
Campaign ๐Scope - Invariant
Campaign ๐Selection - Invariant
Persisted ๐Failure - Holds data about a persisted invariant failure.
- Replay
Context ๐ - Borrowed context shared by primary-invariant and handler-side replay helpers.
Constantsยง
- LIBRARY_
DEPLOYER - When running tests, we deploy all external libraries present in the project. To avoid additional libraries affecting nonces of senders used in tests, we are using separate address to predeploy libraries.
Functionsยง
- base_
counterexamples_ ๐to_ txes - Converts a persisted counterexample to
BasicTxDetails, settingshow_solidityin place. - count_
runnable_ ๐invariant_ campaign_ anchors - function_
matches_ ๐network_ pass - fuzzer_
with_ ๐cases - inline_
config_ ๐for - invariant_
contract_ ๐name - Returns the invariant test contract name without the file path prefix.
- invariant_
failure_ ๐dir - Returns the contract-level invariant failure directory.
- invariant_
failure_ ๐file - Returns the current invariant failure cache path.
- invariant_
suite_ ๐configs_ match - invariant_
suite_ ๐paths - Sets the invariant corpus directory and returns the contract-level failure directory.
- is_
symbolic_ ๐entrypoint - legacy_
invariant_ ๐failure_ file - Returns the legacy invariant failure cache path.
- persisted_
call_ ๐sequence - Helper function to load failed call sequence from file. Ignores failure if generated with different invariant settings than the current ones.
- persisted_
invariant_ ๐failure - Loads a persisted invariant failure from the new cache path, falling back to the legacy path.
- record_
handler_ ๐failure - Persists a handler-side assertion bug under
<failure_dir>/handlers/<site>.json, where<site>iskeccak256(reverter || selector). - record_
invariant_ ๐failure - Helper function to persist invariant failure.
- replay_
persisted_ ๐call_ sequence - Converts a persisted
BaseCounterExamplesequence intoBasicTxDetails(applyingctx.show_solidityin place) and replays it viacheck_sequence. - replay_
persisted_ ๐handler_ failures - Replays persisted handler-side assertion bugs. A file is kept only if the anchor still
asserts at the same
(reverter, selector)site; stale files (anchor no longer asserts, asserts at a different site, or earlier call asserts) are deleted in place. - select_
invariant_ ๐campaigns - test_
paths ๐ - Helper function to set test corpus dir and to compose persisted failure paths.
Type Aliasesยง
- Check
Sequence ๐Result - Mirrors
check_sequenceโs return:(success, replayed_entirely, optional_reason).