forked from move-language/move
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move-docs] Update step 1, step 2, and step 5
Closes: #9936
- Loading branch information
1 parent
1ed0119
commit 9d680d8
Showing
15 changed files
with
177 additions
and
166 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
[package] | ||
name = "BasicCoin" | ||
version = "0.0.0" | ||
|
||
[addresses] | ||
NamedAddr = "0xDEADBEEF" |
2 changes: 1 addition & 1 deletion
2
language/documentation/tutorial/step_1/BasicCoin/sources/FirstModule.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module NamedAddr::Coin { | ||
module 0xCAFE::Coin { | ||
struct Coin has key { | ||
value: u64, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 18 additions & 1 deletion
19
language/documentation/tutorial/step_2/BasicCoin/sources/FirstModule.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
module NamedAddr::Coin { | ||
module 0xCAFE::BasicCoin { | ||
// Only included in compilation for testing. Similar to #[cfg(testing)] | ||
// in Rust. Imports the `Signer` module from the MoveStdlib package. | ||
#[test_only] | ||
use Std::Signer; | ||
|
||
struct Coin has key { | ||
value: u64, | ||
} | ||
|
||
public fun mint(account: signer, value: u64) { | ||
move_to(&account, Coin { value }) | ||
} | ||
|
||
// Declare a unit test. It takes a signer called `account` with an | ||
// address value of `0xC0FFEE`. | ||
#[test(account = @0xC0FFEE)] | ||
fun test_mint_10(account: signer) acquires Coin { | ||
let addr = Signer::address_of(&account); | ||
mint(account, 10); | ||
// Make sure there is a `Coin` resource under `addr` with a value of `10`. | ||
// We can access this resource and its value since we are in the | ||
// same module that defined the `Coin` resource. | ||
assert!(borrow_global<Coin>(addr).value == 10, 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
language/documentation/tutorial/step_2_sol/solution_commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
mpm test -g | ||
# Exercise 1 | ||
move package test -g | ||
|
||
mpm test --coverage | ||
# Exercise 2 | ||
move package test --coverage | ||
|
||
Followed by: | ||
mpm coverage summary | ||
mpm coverage summary --summarize-functions | ||
mpm coverage source --module Coin | ||
|
||
move package coverage summary | ||
move package coverage summary --summarize-functions | ||
move package coverage source --module BasicCoin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters