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

feat: add the grip unit test crate #32

Merged
merged 5 commits into from
Apr 4, 2024
Merged

feat: add the grip unit test crate #32

merged 5 commits into from
Apr 4, 2024

Conversation

alexfertel
Copy link
Contributor

Adds the #[grip::test] proc macro to hide implementation details from users and make writing unit tests seamless.

@alexfertel alexfertel added priority: 2 We will resolve this in a short timeframe. type: feature New feature request. type: test Changes to the testing suite. effort: medium Default level of effort. labels Apr 3, 2024
@alexfertel alexfertel self-assigned this Apr 3, 2024
Copy link

netlify bot commented Apr 3, 2024

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit b373bd8
🔍 Latest deploy log https://app.netlify.com/sites/contracts-stylus/deploys/660dbb682f4f1600082df780

Copy link

codecov bot commented Apr 3, 2024

Codecov Report

Attention: Patch coverage is 95.37572% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 92.0%. Comparing base (3df4d8a) to head (b373bd8).

Additional details and impacted files
Files Coverage Δ
contracts/src/erc20/extensions/metadata.rs 80.9% <100.0%> (-0.9%) ⬇️
contracts/src/erc20/mod.rs 86.5% <100.0%> (-1.1%) ⬇️
contracts/src/lib.rs 100.0% <ø> (ø)
lib/grip-proc/src/lib.rs 100.0% <100.0%> (ø)
lib/grip/src/context.rs 100.0% <100.0%> (ø)
lib/grip/src/shims.rs 100.0% <ø> (ø)
lib/grip/src/storage.rs 100.0% <ø> (ø)
lib/grip-proc/src/test.rs 79.4% <79.4%> (ø)

bidzyyys
bidzyyys previously approved these changes Apr 3, 2024
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

IMHO Looks even better 🚀

How about maintaining grip stuff as external, testing library?

contracts/src/erc20/extensions/metadata.rs Show resolved Hide resolved
lib/grip/src/proc.rs Outdated Show resolved Hide resolved
@alexfertel
Copy link
Contributor Author

alexfertel commented Apr 3, 2024

How about maintaining grip stuff as external, testing library?

What do you mean 👀? It's currently a separate crate in the workspace.

@bidzyyys
Copy link
Collaborator

bidzyyys commented Apr 3, 2024

How about maintaining grip stuff as external, testing library?

What do you mean 👀? It's currently a separate crate in the workspace.

I am thinking about having it as a dedicated repository. So our smart contracts will need to have additional dependency, but future developers may only import this dedicated repository instead of fetching the smart contract library. Just as an open idea, no effort needed.

@bidzyyys bidzyyys self-requested a review April 3, 2024 15:56
bidzyyys
bidzyyys previously approved these changes Apr 3, 2024
@alexfertel
Copy link
Contributor Author

I am thinking about having it as a dedicated repository. So our smart contracts will need to have additional dependency, but future developers may only import this dedicated repository instead of fetching the smart contract library. Just as an idea.

So you would be able to use grip by just running cargo add grip. If we haven't published yet to crates.io, devs could pull grip by specifying this repo as a git dependency. You can learn more about this in the cargo docs.

It would look like this:

[dependencies]
grip = { git = "https://github.com/OpenZeppelin/rust-contracts-stylus.git" }

@qalisander
Copy link
Member

Looks awesome!
One question I have. How did you come up with the name grip?

qalisander
qalisander previously approved these changes Apr 3, 2024
@alexfertel
Copy link
Contributor Author

One question I have. How did you come up with the name grip?

So I wanted it to have something to do with Stylus so I searched on google what parts constitute a stylus pen, and the grip seemed appropriate.

Do you like it?

@alexfertel alexfertel dismissed stale reviews from qalisander and bidzyyys via bf1b982 April 3, 2024 20:25
@bidzyyys bidzyyys self-requested a review April 4, 2024 06:11
@alexfertel alexfertel merged commit 1934d3d into main Apr 4, 2024
18 checks passed
@alexfertel alexfertel deleted the rework-unit-tests branch April 4, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium Default level of effort. priority: 2 We will resolve this in a short timeframe. type: feature New feature request. type: test Changes to the testing suite.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants