diff --git a/README.md b/README.md index 1c04aaf..f63c082 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ A Foundry-based template for developing Solidity smart contracts, with sensible - [Forge](https://github.com/foundry-rs/foundry/blob/master/forge): compile, test, fuzz, format, and deploy smart contracts -- [Forge Std](https://github.com/foundry-rs/forge-std): collection of helpful contracts and cheatcodes for testing -- [PRBTest](https://github.com/PaulRBerg/prb-test): modern collection of testing assertions and logging utilities +- [Forge Std](https://github.com/foundry-rs/forge-std): collection of helpful contracts and utilities for testing - [Prettier](https://github.com/prettier/prettier): code formatter for non-Solidity files - [Solhint](https://github.com/protofire/solhint): linter for Solidity code @@ -92,10 +91,10 @@ Note that OpenZeppelin Contracts is pre-installed, so you can follow that as an ## Writing Tests -To write a new test contract, you start by importing [PRBTest](https://github.com/PaulRBerg/prb-test) and inherit from -it in your test contract. PRBTest comes with a pre-instantiated [cheatcodes](https://book.getfoundry.sh/cheatcodes/) -environment accessible via the `vm` property. If you would like to view the logs in the terminal output you can add the -`-vvv` flag and use [console.log](https://book.getfoundry.sh/faq?highlight=console.log#how-do-i-use-consolelog). +To write a new test contract, you start by importing `Test` from `forge-std`, and then you inherit it in your test +contract. Forge Std comes with a pre-instantiated [cheatcodes](https://book.getfoundry.sh/cheatcodes/) environment +accessible via the `vm` property. If you would like to view the logs in the terminal output, you can add the `-vvv` flag +and use [console.log](https://book.getfoundry.sh/faq?highlight=console.log#how-do-i-use-consolelog). This template comes with an example test contract [Foo.t.sol](./test/Foo.t.sol) diff --git a/bun.lockb b/bun.lockb index 204be62..a72ec4f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index d482308..80569b6 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,7 @@ "@openzeppelin/contracts": "^5.0.1" }, "devDependencies": { - "@prb/test": "^0.6.4", - "forge-std": "github:foundry-rs/forge-std#v1.7.5", + "forge-std": "github:foundry-rs/forge-std#v1.8.1", "prettier": "^3.0.0", "solhint": "^3.6.2" }, diff --git a/remappings.txt b/remappings.txt index 7dcebe4..550f908 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,3 +1,2 @@ @openzeppelin/contracts/=node_modules/@openzeppelin/contracts/ -@prb/test/=node_modules/@prb/test/ forge-std/=node_modules/forge-std/ diff --git a/test/Foo.t.sol b/test/Foo.t.sol index e3dd7ba..727337a 100644 --- a/test/Foo.t.sol +++ b/test/Foo.t.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.25 <0.9.0; -import { PRBTest } from "@prb/test/src/PRBTest.sol"; +import { Test } from "forge-std/src/Test.sol"; import { console2 } from "forge-std/src/console2.sol"; -import { StdCheats } from "forge-std/src/StdCheats.sol"; import { Foo } from "../src/Foo.sol"; @@ -13,7 +12,7 @@ interface IERC20 { /// @dev If this is your first time with Forge, read this tutorial in the Foundry Book: /// https://book.getfoundry.sh/forge/writing-tests -contract FooTest is PRBTest, StdCheats { +contract FooTest is Test { Foo internal foo; /// @dev A function invoked before each test case is run. @@ -23,7 +22,7 @@ contract FooTest is PRBTest, StdCheats { } /// @dev Basic test. Run it with `forge test -vvv` to see the console log. - function test_Example() external { + function test_Example() external view { console2.log("Hello World"); uint256 x = 42; assertEq(foo.id(x), x, "value mismatch"); @@ -32,7 +31,7 @@ contract FooTest is PRBTest, StdCheats { /// @dev Fuzz test that provides random values for an unsigned integer, but which rejects zero as an input. /// If you need more sophisticated input validation, you should use the `bound` utility instead. /// See https://twitter.com/PaulRBerg/status/1622558791685242880 - function testFuzz_Example(uint256 x) external { + function testFuzz_Example(uint256 x) external view { vm.assume(x != 0); // or x = bound(x, 1, 100) assertEq(foo.id(x), x, "value mismatch"); }