Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replace DSTestFull with Test #38

Merged
merged 7 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
"package.json": "sort-package-json"
},
"dependencies": {
"ds-test": "github:dapphub/ds-test#e282159",
"forge-std": "github:foundry-rs/forge-std#v1.7.3",
"isolmate": "github:defi-wonderland/isolmate#59e1804",
"prb/test": "github:paulrberg/prb-test#v0.6.5"
"isolmate": "github:defi-wonderland/isolmate#59e1804"
},
"devDependencies": {
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
"ds-test": "github:dapphub/ds-test#e282159",
"forge-std": "github:foundry-rs/forge-std#v1.7.3",
"husky": ">=8",
"lint-staged": ">=10",
"solhint": "3.6.2",
Expand Down
1 change: 0 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ds-test/=node_modules/ds-test/src
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, should we remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, it doesn't work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but why?

because of the import in Test.sol
image

prb/test/=node_modules/prb/test/src/
forge-std/=node_modules/forge-std/src
isolmate/=node_modules/isolmate/src

Expand Down
8 changes: 4 additions & 4 deletions solidity/test/integration/IntegrationBase.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

import {DSTestFull} from 'test/utils/DSTestFull.sol';
import {IERC20} from 'isolmate/interfaces/tokens/IERC20.sol';
import {Test} from 'forge-std/Test.sol';

import {Greeter, IGreeter} from 'contracts/Greeter.sol';

contract IntegrationBase is DSTestFull {
contract IntegrationBase is Test {
uint256 internal constant _FORK_BLOCK = 15_452_788;

string internal _initialGreeting = 'hola';
address internal _user = _label('user');
address internal _owner = _label('owner');
address internal _user = makeAddr('user');
address internal _owner = makeAddr('owner');
address internal _daiWhale = 0x42f8CA49E88A8fd8F0bfA2C739e648468b8f9dec;
IERC20 internal _dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
IGreeter internal _greeter;
Expand Down
12 changes: 7 additions & 5 deletions solidity/test/unit/Greeter.t.sol
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

Check warning on line 2 in solidity/test/unit/Greeter.t.sol

View workflow job for this annotation

GitHub Actions / Run Linters (18.x)

Found more than One contract per file. 4 contracts found!

import {IERC20} from 'isolmate/interfaces/tokens/IERC20.sol';
import {DSTestFull} from 'test/utils/DSTestFull.sol';
import {Test} from 'forge-std/Test.sol';
import {Greeter, IGreeter} from 'contracts/Greeter.sol';

abstract contract Base is DSTestFull {
address internal _owner = _label('owner');
IERC20 internal _token = IERC20(_mockContract('token'));
abstract contract Base is Test {
address internal _owner = makeAddr('owner');

IERC20 internal _token = IERC20(makeAddr('token'));
string internal _initialGreeting = 'hola';
bytes32 internal _emptyString = keccak256(bytes(''));
Greeter internal _greeter;

function setUp() public virtual {
vm.etch(address(_token), new bytes(0x1)); // etch bytecode to avoid address collision problems
vm.prank(_owner);
_greeter = new Greeter(_initialGreeting, _token);
}
Expand Down Expand Up @@ -74,7 +76,7 @@
function test_EmitEvent(string memory _greeting) public {
vm.assume(keccak256(bytes(_greeting)) != _emptyString);

_expectEmitNoIndex();
vm.expectEmit(true, true, true, true, address(_greeter));
emit GreetingSet(_greeting);

_greeter.setGreeting(_greeting);
Expand Down
67 changes: 0 additions & 67 deletions solidity/test/utils/DSTestFull.sol

This file was deleted.

7 changes: 3 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,9 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==

"forge-std@github:foundry-rs/forge-std#v1.7.3":
version "1.7.3"
resolved "https://codeload.github.com/foundry-rs/forge-std/tar.gz/2f112697506eab12d433a65fdc31a639548fe365"
"forge-std@github:foundry-rs/forge-std#v1.7.3":
version "1.7.3"
resolved "https://codeload.github.com/foundry-rs/forge-std/tar.gz/2f112697506eab12d433a65fdc31a639548fe365"
Expand Down Expand Up @@ -1920,10 +1923,6 @@ pluralize@^8.0.0:
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"
integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==

"prb/test@github:paulrberg/prb-test#v0.6.5":
version "0.6.5"
resolved "https://codeload.github.com/paulrberg/prb-test/tar.gz/2ece8755d9afe7d66440ef9ca19b8a9dab40164b"

prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
Expand Down