How foundry-rs/forge-std works
Forge Standard Library is a Solidity utility library for Foundry tests and scripts. The main workflow is a test author using Test and its helpers to set up state, invoke assertions or inspect storage, and use Forge cheatcodes to control or observe execution. Other documented capabilities include TOML configuration, JSON/TOML utilities, chain metadata, invariant support, console output, and standard token interfaces. The README supports the documented helper behavior; source excerpts were not provided to verify internal wiring beyond that.
Main entry points: Vm.sol Cheatcode Interface · Test.sol Test · Script.sol Script · StdCheats.sol Cheat Wrappers
Components 22
Test Entry Points
- Test
src/Test.sol - Script
src/Script.sol - Cheatcode Interface
src/Vm.sol
Testing Helpers
- Assertions
src/StdAssertions.sol - Cheat Wrappers
src/StdCheats.sol - Storage Discovery
src/StdStorage.sol - Invariant Helpers
src/StdInvariant.sol - Revert Errors
src/StdError.sol
Data And Config
- TOML Config
src/StdConfig.sol - TOML Utilities
src/StdToml.sol - JSON Utilities
src/StdJson.sol - Chain Metadata
src/StdChains.sol
Runtime Support
- General Utilities
src/StdUtils.sol - Math
src/StdMath.sol - Constants
src/StdConstants.sol - Console Output
src/console.sol - Console Output 2
src/console2.sol - Safe Console
src/safeconsole.sol - Token Interfaces
src/interfaces - Secp256k1
src/StdSecp256k1.sol
Other components
- Test Author
- Foundry Runtime
Connections 11
- Test Author → Test: uses
- Test Author → Script: uses
- Test → Cheatcode Interface: uses cheatcodes
- Script → Cheatcode Interface: uses cheatcodes
- Cheatcode Interface → Foundry Runtime: dispatches to
- Storage Discovery → Cheatcode Interface: records storage access
- Cheat Wrappers → Cheatcode Interface: wraps cheatcodes
- Test Author → Assertions: asserts with
- Test Author → Storage Discovery: finds or writes
- Test Author → Cheat Wrappers: sets test state
- Test Author → TOML Config: loads config