You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: language/documentation/book/src/unit-testing.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ fun test_only_function(...) { ... }
95
95
96
96
## Running Unit Tests
97
97
98
-
Unit tests for a Move package can be run with the [`move package test`
98
+
Unit tests for a Move package can be run with the [`move test`
99
99
command](./packages.md).
100
100
101
101
When running tests, every test will either `PASS`, `FAIL`, or `TIMEOUT`. If a test case fails, the location of the failure along with the function name that caused the failure will be reported if possible. You can see an example of this below.
@@ -105,7 +105,7 @@ A test will be marked as timing out if it exceeds the maximum number of instruct
105
105
There are also a number of options that can be passed to the unit testing binary to fine-tune testing and to help debug failing tests. These can be found using the the help flag:
106
106
107
107
```
108
-
$ move package -h
108
+
$ move -h
109
109
```
110
110
111
111
## Example
@@ -114,7 +114,7 @@ A simple module using some of the unit testing features is shown in the followin
114
114
115
115
First create an empty package and change directory into it:
116
116
```
117
-
$ move package new TestExample; cd TestExample
117
+
$ move new TestExample; cd TestExample
118
118
```
119
119
120
120
Next add the following to the `Move.toml`:
@@ -173,10 +173,10 @@ module 0x1::my_module {
173
173
174
174
### Running Tests
175
175
176
-
You can then run these tests with the `move package test` command:
176
+
You can then run these tests with the `move test` command:
177
177
178
178
```
179
-
$ move package test
179
+
$ move test
180
180
BUILDING MoveStdlib
181
181
BUILDING TestExample
182
182
Running Move unit tests
@@ -192,7 +192,7 @@ Test result: OK. Total tests: 3; passed: 3; failed: 0
192
192
This will only run tests whose fully qualified name contains `<str>`. For example if we wanted to only run tests with `"zero_coin"` in their name:
193
193
194
194
```
195
-
$ move package test -f zero_coin
195
+
$ move test -f zero_coin
196
196
CACHED MoveStdlib
197
197
BUILDING TestExample
198
198
Running Move unit tests
@@ -205,7 +205,7 @@ Test result: OK. Total tests: 2; passed: 2; failed: 0
205
205
This bounds the number of instructions that can be executed for any one test to `<bound>`:
206
206
207
207
```
208
-
$ move package test -i 0
208
+
$ move test -i 0
209
209
CACHED MoveStdlib
210
210
BUILDING TestExample
211
211
Running Move unit tests
@@ -238,7 +238,7 @@ Test result: FAILED. Total tests: 3; passed: 0; failed: 3
238
238
With these flags you can gather statistics about the tests run and report the runtime and instructions executed for each test. For example, if we wanted to see the statistics for the tests in the example above:
239
239
240
240
```
241
-
$ move package test -s
241
+
$ move test -s
242
242
CACHED MoveStdlib
243
243
BUILDING TestExample
244
244
Running Move unit tests
@@ -279,7 +279,7 @@ module 0x1::my_module {
279
279
we would get get the following output when running the tests:
You can check that it is working by running the following command:
56
56
57
57
```bash
58
-
move package --help
58
+
move --help
59
59
```
60
60
61
61
You should see something like this along with a list and description of a
@@ -153,18 +153,18 @@ Let's take a look at this function and what it's saying:
153
153
* It creates a `Coin` with the given value and stores it under the
154
154
`account` using the `move_to` operator.
155
155
156
-
Let's make sure it builds! This can be done with the `package build` command from within the package folder ([`step_1/BasicCoin`](./step_1/BasicCoin/)):
156
+
Let's make sure it builds! This can be done with the `build` command from within the package folder ([`step_1/BasicCoin`](./step_1/BasicCoin/)):
157
157
158
158
```bash
159
-
move package build
159
+
move build
160
160
```
161
161
162
162
<details>
163
163
<summary>Advanced concepts and references</summary>
164
164
165
165
* You can create an empty Move package by calling:
166
166
```bash
167
-
move package new <pkg_name>
167
+
move new <pkg_name>
168
168
```
169
169
* Move code can also live a number of other places. More information on the
170
170
Move package system can be found in the [Move
@@ -213,7 +213,7 @@ unit tests in Rust if you're familiar with them -- tests are annotated with
213
213
You can run the tests with the `package test` command:
214
214
215
215
```bash
216
-
move package test
216
+
move test
217
217
```
218
218
219
219
Let's now take a look at the contents of the [`FirstModule.move`
@@ -263,7 +263,7 @@ assertion fails the unit test will fail.
263
263
264
264
#### Exercises
265
265
* Change the assertion to `11` so that the test fails. Find a flag that you can
266
-
pass to the `move package test`command that will show you the global state when
266
+
pass to the `move test`command that will show you the global state when
267
267
the test fails. It should look something like this:
268
268
```
269
269
┌── test_mint_10 ──────
@@ -286,7 +286,7 @@ assertion fails the unit test will fail.
286
286
└──────────────────
287
287
```
288
288
* Find a flag that allows you to gather test coverage information, and
289
-
then play around with using the `move package coverage`command to look at
289
+
then play around with using the `move coverage`command to look at
290
290
coverage statistics and source coverage.
291
291
292
292
</details>
@@ -376,7 +376,7 @@ implementation of the methods inside [`BasicCoin.move`](./step_4/BasicCoin/sourc
376
376
Let's first try building the code using Move package by running the following command
377
377
in [`step_4/BasicCoin`](./step_4/BasicCoin) folder:
378
378
```bash
379
-
move package build
379
+
move build
380
380
```
381
381
382
382
### Implementation of methods
@@ -466,7 +466,7 @@ take a look at some tools we can use to help us write tests.
466
466
To get started, run the `package test` command in the [`step_5/BasicCoin`](./step_5/BasicCoin) folder
467
467
468
468
```bash
469
-
move package test
469
+
move test
470
470
```
471
471
472
472
You should see something like this:
@@ -576,7 +576,7 @@ Informally speaking, the block `spec balance_of {...}` contains the property spe
576
576
577
577
Let's first run the prover using the following command inside [`BasicCoin` directory](./step_7/BasicCoin/):
578
578
```bash
579
-
move package prove
579
+
move prove
580
580
```
581
581
582
582
which outputs the following error information:
@@ -611,7 +611,7 @@ The prover basically tells us that we need to explicitly specify the condition u
611
611
```
612
612
After adding this condition, try running the `prove` command again to confirm that there are no verification errors:
613
613
```bash
614
-
move package prove
614
+
move prove
615
615
```
616
616
Apart from the abort condition, we also want to define the functional properties. In Step 8, we will give more detailed introduction to the prover by specifying properties for the methods defined the `BasicCoin` module.
Copy file name to clipboardexpand all lines: language/evm/examples/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -11,4 +11,4 @@ This directory contains (a growing set of) examples of "Move-on-EVM", a programm
11
11
-[ERC1155.move](./sources/ERC1155.move) contains an implementation of ERC1155 which is the standard for multi-tokens.
12
12
-[TestUniswap.move](./sources/TestUniswap.move) and [TestUniswapLiquidity.move](./sources/TestUniswapLiquidity.move) are the sample client modules of `Uniswap`.
13
13
14
-
This directory is a Move package. To build the source files, use `move package build`. Moreover, use `move package test` to run the unit tests located in the `tests` directory.
14
+
This directory is a Move package. To build the source files, use `move build`. Moreover, use `move test` to run the unit tests located in the `tests` directory.
0 commit comments