diff --git a/projects/cheatcodes/test/BlastMock.t.sol b/projects/cheatcodes/test/BlastMock.t.sol index 62b6bf8ca..e80dc918d 100644 --- a/projects/cheatcodes/test/BlastMock.t.sol +++ b/projects/cheatcodes/test/BlastMock.t.sol @@ -2,15 +2,19 @@ // ANCHOR: all pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; // Firstly, we implement a mock emulating the actual precompile behavior contract YieldMock { - address private constant blastContract = 0x4300000000000000000000000000000000000002; + address private constant blastContract = + 0x4300000000000000000000000000000000000002; mapping(address => uint8) public getConfiguration; - function configure(address contractAddress, uint8 flags) external returns (uint256) { + function configure( + address contractAddress, + uint8 flags + ) external returns (uint256) { require(msg.sender == blastContract); getConfiguration[contractAddress] = flags; @@ -32,10 +36,13 @@ contract SomeBlastTest is Test { // Deploy mock of the precompile YieldMock yieldMock = new YieldMock(); // Set mock bytecode to the expected precompile address - vm.etch(0x0000000000000000000000000000000000000100, address(yieldMock).code); + vm.etch( + 0x0000000000000000000000000000000000000100, + address(yieldMock).code + ); } function testSomething() public { // Now we can interact with Blast contracts without reverts } -} \ No newline at end of file +} diff --git a/projects/cheatcodes/test/EmitContract.t.sol b/projects/cheatcodes/test/EmitContract.t.sol index 9b7439456..7756324d5 100644 --- a/projects/cheatcodes/test/EmitContract.t.sol +++ b/projects/cheatcodes/test/EmitContract.t.sol @@ -2,7 +2,7 @@ // ANCHOR: all pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract EmitContractTest is Test { event Transfer(address indexed from, address indexed to, uint256 amount); diff --git a/projects/cheatcodes/test/OwnerUpOnly.t.sol b/projects/cheatcodes/test/OwnerUpOnly.t.sol index 9b43bea18..8958f7392 100644 --- a/projects/cheatcodes/test/OwnerUpOnly.t.sol +++ b/projects/cheatcodes/test/OwnerUpOnly.t.sol @@ -3,7 +3,7 @@ // ANCHOR: prelude pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; error Unauthorized(); // ANCHOR_END: prelude @@ -30,7 +30,7 @@ contract OwnerUpOnly { // ANCHOR: contract_prelude contract OwnerUpOnlyTest is Test { OwnerUpOnly upOnly; -// ANCHOR_END: contract_prelude + // ANCHOR_END: contract_prelude // ANCHOR: simple_test function setUp() public { diff --git a/projects/fuzz_testing/test/Safe.t.sol b/projects/fuzz_testing/test/Safe.t.sol index c1cd8de9b..ba00a0660 100644 --- a/projects/fuzz_testing/test/Safe.t.sol +++ b/projects/fuzz_testing/test/Safe.t.sol @@ -2,7 +2,7 @@ // ANCHOR: all pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract Safe { receive() external payable {} @@ -25,7 +25,7 @@ contract SafeTest is Test { // ANCHOR: signature function testFuzz_Withdraw(uint96 amount) public { - // ANCHOR_END: signature + // ANCHOR_END: signature payable(address(safe)).transfer(amount); uint256 preBalance = address(this).balance; safe.withdraw(); diff --git a/projects/fuzz_testing/test/Safe.t.sol.1 b/projects/fuzz_testing/test/Safe.t.sol.1 index 42cbad3ad..4df224ba6 100644 --- a/projects/fuzz_testing/test/Safe.t.sol.1 +++ b/projects/fuzz_testing/test/Safe.t.sol.1 @@ -2,7 +2,7 @@ // ANCHOR: all pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract Safe { receive() external payable {} diff --git a/projects/fuzz_testing/test/Safe.t.sol.2 b/projects/fuzz_testing/test/Safe.t.sol.2 index 0d724b4ab..b6d3b8976 100644 --- a/projects/fuzz_testing/test/Safe.t.sol.2 +++ b/projects/fuzz_testing/test/Safe.t.sol.2 @@ -2,7 +2,7 @@ // ANCHOR: all pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract Safe { receive() external payable {} diff --git a/projects/fuzz_testing/test/Safe.t.sol.3 b/projects/fuzz_testing/test/Safe.t.sol.3 index c1cd8de9b..a059d39c6 100644 --- a/projects/fuzz_testing/test/Safe.t.sol.3 +++ b/projects/fuzz_testing/test/Safe.t.sol.3 @@ -2,7 +2,7 @@ // ANCHOR: all pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract Safe { receive() external payable {} diff --git a/projects/test_filters/test/ComplicatedContract.t.sol b/projects/test_filters/test/ComplicatedContract.t.sol index 7e3977ad1..e68a7d85d 100644 --- a/projects/test_filters/test/ComplicatedContract.t.sol +++ b/projects/test_filters/test/ComplicatedContract.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract ComplicatedContractTest is Test { function test_DepositERC20() public pure { diff --git a/projects/test_filters/test/ContractB.t.sol b/projects/test_filters/test/ContractB.t.sol index 2aa12c16e..379f4e135 100644 --- a/projects/test_filters/test/ContractB.t.sol +++ b/projects/test_filters/test/ContractB.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract ContractBTest is Test { function testExample() public { diff --git a/projects/writing_tests/test/Basic.t.sol b/projects/writing_tests/test/Basic.t.sol index 45df22a7a..837da365a 100644 --- a/projects/writing_tests/test/Basic.t.sol +++ b/projects/writing_tests/test/Basic.t.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.10; // ANCHOR: import -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; // ANCHOR_END: import contract ContractBTest is Test { diff --git a/projects/writing_tests/test/Basic2.t.sol b/projects/writing_tests/test/Basic2.t.sol index dde81d4f1..bf4e78e7e 100644 --- a/projects/writing_tests/test/Basic2.t.sol +++ b/projects/writing_tests/test/Basic2.t.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.10; // ANCHOR: import -import "forge-std/Test.sol"; +import {Test, stdError} from "forge-std/Test.sol"; // ANCHOR_END: import contract ContractBTest is Test { diff --git a/src/forge/differential-ffi-testing.md b/src/forge/differential-ffi-testing.md index ad056f2c4..b38deed09 100644 --- a/src/forge/differential-ffi-testing.md +++ b/src/forge/differential-ffi-testing.md @@ -23,7 +23,7 @@ Below are some examples of how Forge is used for differential testing. [`ffi`](../cheatcodes/ffi.md) allows you to execute an arbitrary shell command and capture the output. Here's a mock example: ```solidity -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract TestContract is Test { diff --git a/src/forge/forge-std.md b/src/forge/forge-std.md index 0413db230..0b724032d 100644 --- a/src/forge/forge-std.md +++ b/src/forge/forge-std.md @@ -14,7 +14,7 @@ It provides all the essential functionality you need to get started writing test Simply import `Test.sol` and inherit from `Test` in your test contract: ```solidity -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract ContractTest is Test { ... ``` diff --git a/src/reference/ds-test.md b/src/reference/ds-test.md index a45180497..14c4a91bf 100644 --- a/src/reference/ds-test.md +++ b/src/reference/ds-test.md @@ -5,7 +5,7 @@ Dappsys Test (DSTest for short) provides basic logging and assertion functionali To get access to the functions, import `forge-std/Test.sol` and inherit from `Test` in your test contract: ```solidity -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract ContractTest is Test { // ... tests ... diff --git a/src/reference/forge-std/README.md b/src/reference/forge-std/README.md index e52e41b06..a877062c8 100644 --- a/src/reference/forge-std/README.md +++ b/src/reference/forge-std/README.md @@ -9,31 +9,31 @@ What's included: - `Vm.sol`: Up-to-date [cheatcodes interface](../../cheatcodes/#cheatcodes-interface) ```solidity - import "forge-std/Vm.sol"; + import {Vm} from "forge-std/Vm.sol"; ``` - [`console.sol`](./console-log.md) and `console2.sol`: Hardhat-style logging functionality ```solidity - import "forge-std/console.sol"; + import {console} from "forge-std/console.sol"; ``` **Note:** `console2.sol` contains patches to `console.sol` that allow Forge to decode traces for calls to the console, but it is not compatible with Hardhat. ```solidity - import "forge-std/console2.sol"; + import {console2} from "forge-std/console2.sol"; ``` - `Script.sol`: Basic utilities for [Solidity scripting](../../tutorials/solidity-scripting.md) ```solidity - import "forge-std/Script.sol"; + import {Script} from "forge-std/Script.sol"; ``` - `Test.sol`: The complete Forge Std experience (more details [below](#forge-stds-test)) ```solidity - import "forge-std/Test.sol"; + import {Test} from "forge-std/Test.sol"; ``` ### Forge Std's `Test` @@ -43,7 +43,7 @@ The `Test` contract in `Test.sol` provides all the essential functionality you n Simply import `Test.sol` and inherit from `Test` in your test contract: ```solidity -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; contract ContractTest is Test { ... ``` diff --git a/src/tutorials/create2-tutorial.md b/src/tutorials/create2-tutorial.md index 509a8bf27..f31e0ee1e 100644 --- a/src/tutorials/create2-tutorial.md +++ b/src/tutorials/create2-tutorial.md @@ -174,7 +174,7 @@ Initialize a contract named `Create2Test` like this: // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; import {Counter} from "../src/Counter.sol"; import {Create2} from "../src/Create2.sol"; diff --git a/src/tutorials/solmate-nft.md b/src/tutorials/solmate-nft.md index f371ef946..e2cd955bb 100644 --- a/src/tutorials/solmate-nft.md +++ b/src/tutorials/solmate-nft.md @@ -195,7 +195,7 @@ Within your test folder rename the current `Contract.t.sol` test file to `NFT.t. // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.10; -import "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; import "../src/NFT.sol"; contract NFTTest is Test {