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

Added description of basic Move testing to the docs #575

Merged
merged 2 commits into from
Feb 27, 2022
Merged

Conversation

awelc
Copy link
Contributor

@awelc awelc commented Feb 26, 2022

Another bite-sized piece of Move developer docs covering basics of testing.

The next step is to introduce TestScenario module to have more of a "Sui feel" in testing code (and also to show how a package can be published using wallet CLI).

doc/move.md Outdated Show resolved Hide resolved
doc/move.md Outdated Show resolved Hide resolved
get a compilation error:

``` shell
error[E06001]: unused value without 'drop'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Excellent example of a problem to debug--folks new to linearity will definitely run into this all the time!

``` rust
// create a dummy address and transfer the sword
let dummy_address = @0xCAFE;
Transfer::transfer(sword, dummy_address);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should make TestScenario::delete_for_testing public. This would make things a bit more ergonomic for testers since they won't need to think of a dummy address.

Even if we make that change, we should keep your explanation from 479--495 about what the error means--I think that is a valuable point to make.

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 think it's a good idea. I would still keep this particular way of solving this problem here as I plan to introduce TestScenario next as a Sui-specific library that helps writing Sui-specific tests (as opposed to the "pure" Move testing scenario). At the same time, I did not want to overwhelm the reader with introducing this library right away. Obviously I am happy to change this flow (or better yet, have someone else finesse it :-) ) if we decide on a better one.

@awelc awelc merged commit 1168b64 into main Feb 27, 2022
@awelc awelc deleted the aw/move-docs-2 branch February 27, 2022 01:27
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 this pull request may close these issues.

[CLI] Developer docs - smart contracts with sui-move CLI
2 participants