-
Notifications
You must be signed in to change notification settings - Fork 24
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
ref: Add/Sub Assignment Operations + e2e-tests.sh #467
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for contracts-stylus canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
|
cargo test --features std,e2e --test "*" | ||
else | ||
cargo test --features std,e2e "$@" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script can now be called in the following ways:
- if no arguments are passed, the behavior is the same as before
- otherwise, pass whatever arguments are present to
cargo test
directly
We can now easily filter for even unit tests with this script.
This should cover most of our testing needs.
NOTE: feel free to suggest or add any additional feature you think might be useful.
NOTE 2: we don't seem to be needing std
feature for e2e tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to omit the if-statement, and just call cargo test --features e2e "$@"
, passing whatever arguments to the command. In our e2e workflow, we'd then call the script like ./scripts/e2e-tests.sh --test "*"
.
I'd be more in favor of this approach, but my first instinct was to keep the existing behavior as much as possible, and only change it after discussing it with you guys.
At this point it's really a matter of taste
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave right now the current behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious what will be different in devex with these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, it lets you call this script as if you were to call cargo test
, meaning it enables you to do all the funky filtering stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation is the simplest one, with the most straightforward way to use.
Updating the script to support invocations like:
./scripts/e2e-tests.sh erc721 error_when_minting_token_id_twice
Would make it very complex if we also wanted to support passing other valid args/flags to cargo test
, or to the test binary.
But actually what I like very much in your approach, is that if we spell ./scripts/e2e-tests.sh --help it will print docs for cargo sub commands. So no need to bother ourselves with script's documentation
Can you clarify the last sentence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep your changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify the last sentence?
I mean, that we can print valid documentation for e2e-test.sh
script, since we're just forwarding arguments to cargo test
:
./scripts/e2e-tests.sh --help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the script then have your blessing? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bless:D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can apply #[allow(clippy::used_underscore_binding)]
for the whole contracts library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments, good job @0xNeshi
Co-authored-by: Daniel Bigos <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready to merge!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
cargo test --features std,e2e --test "*" | ||
else | ||
cargo test --features std,e2e "$@" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave right now the current behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
cargo test --features std,e2e --test "*" | ||
else | ||
cargo test --features std,e2e "$@" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious what will be different in devex with these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves #445, Resolves #444
PR Checklist