SunWeb3Sec/DeFiHackLabs

What is the difference between Test and DSTest?

seyyedaliayati opened this issue · 3 comments

In some test cases like src/test/88mph_exp.sol, you have:

contract ContractTest is DSTest {
...
}

And, in some test cases like src/test/BUNN_exp.sol, there is:

contract ContractTest is Test {
...
}

I am wondering what the difference is between these two. I have already taken a look at the forge-std library:

abstract contract Test is DSTest, Script {
}

So, can I replace DSTest with Test in the test cases?

Some cases can replace to DSTest. only key different is solidity version requirement:
Test: pragma solidity >=0.5.0;
DSTest: pragma solidity >=0.6.2 <0.9.0;

Some cases can replace to DSTest. only key different is solidity version requirement:
Test: pragma solidity >=0.5.0;
DSTest: pragma solidity >=0.6.2 <0.9.0;

So, actually we can always replace DSTest with Test. Because pragma solidity >=0.6.2 <0.9.0 is also compatible with pragma solidity >=0.5.0. Am I right?

If your solidity dependency is under 0.6.2, you should use ds-test instead of forge std.