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

Meta: Unbundling the cheats from the assertions (leg 1) #122

Closed
PaulRBerg opened this issue Jul 15, 2022 · 1 comment · Fixed by #126
Closed

Meta: Unbundling the cheats from the assertions (leg 1) #122

PaulRBerg opened this issue Jul 15, 2022 · 1 comment · Fixed by #126

Comments

@PaulRBerg
Copy link
Contributor

PaulRBerg commented Jul 15, 2022

Description

The way the Test contract is currently architected is not in line with the principle of separation of concerns.

The most problematic thing IMHO is the fact that the cheats and assertions live under the same roof. This makes it difficult for Forge Std to be composed with other testing assertion contracts, such as PRBTest.

Of course, I'm a bit biased because of PRBTest, but even if we nevermind my intentions, there are many reasons for why people may wish to write their own testing assertion contracts. If anything, maybe they simply don't like either DSTest or PRBTest. Or perhaps they're working with user-defined value types, which need certain overloads for assertEq. Or perhaps they're using a fork of the EVM on which DSTest doesn't compile or doesn't work well. Bottom line is: Forge Std is not as modular as it could be.

Additionally, separating the cheats from the assertions would also tidy up the contracts a bit, since there would be fewer lines of code in each contract.

Solution

Create a Cheats contract and move all cheats there. Test would then inherit from Cheats.

Doing this would make Forge Std more modular. Users would be able to selectively use just the cheats or just the assertions.

@PaulRBerg PaulRBerg mentioned this issue Jul 15, 2022
11 tasks
@PaulRBerg PaulRBerg changed the title Meta: Unbundling the cheats from the assertions Meta: Unbundling the cheats from the assertions (leg 1) Jul 15, 2022
@ZeroEkkusu ZeroEkkusu linked a pull request Jul 26, 2022 that will close this issue
11 tasks
@PaulRBerg
Copy link
Contributor Author

PaulRBerg commented Jul 26, 2022

Closing as completed since #126 has been merged on the v0.3 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant