Skip to content

Commit

Permalink
[move-cli] added unit tests for coverage merging functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
meng-xu-cs authored and bors-libra committed Dec 1, 2020
1 parent be7c260 commit 676934d
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 17 deletions.
24 changes: 22 additions & 2 deletions language/tools/move-cli/tests/metatests/args.exp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,31 @@ Command `test dummy/test_2`:
1 / 1 test(s) passed.
Command `test dummy`:
2 / 2 test(s) passed.
Command `test cov`:
Command `test cov/plain --track-cov`:
1 / 1 test(s) passed.
Command `test cov --track-cov`:
Module 00000000000000000000000000000042::M
fun test
total: 1
covered: 1
% coverage: 100.00
>>> % Module coverage: 100.00
Command `test cov/two-runs-same-module --track-cov`:
1 / 1 test(s) passed.
Module 00000000000000000000000000000042::M
fun test
total: 7
covered: 7
% coverage: 100.00
>>> % Module coverage: 100.00
Command `test cov/two-runs-diff-module --track-cov`:
1 / 1 test(s) passed.
Module 00000000000000000000000000000042::M1
fun test
total: 1
covered: 1
% coverage: 100.00
>>> % Module coverage: 100.00
Module 00000000000000000000000000000042::M2
fun test
total: 1
covered: 1
Expand Down
5 changes: 3 additions & 2 deletions language/tools/move-cli/tests/metatests/args.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test dummy/test_1/args.txt
test dummy/test_2
test dummy
test cov
test cov --track-cov
test cov/plain --track-cov
test cov/two-runs-same-module --track-cov
test cov/two-runs-diff-module --track-cov
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
address 0x42 {
module M {
public fun test() {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
script {
use 0x42::M;

fun main() {
M::test();
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Command `publish src/modules --mode bare`:
Command `run src/scripts/test.move --args 0u8 --mode bare --dry-run`:
Command `run src/scripts/test.move --args 1u8 --mode bare --dry-run`:
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
publish src/modules --mode bare
run src/scripts/test.move --args 0u8 --mode bare --dry-run
run src/scripts/test.move --args 1u8 --mode bare --dry-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
address 0x42 {
module M1 {
public fun test() {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
address 0x42 {
module M2 {
public fun test() {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
script {
use 0x42::M1;
use 0x42::M2;

fun main(x: u8) {
if (x == 0) {
M1::test();
} else {
M2::test();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Command `publish src/modules --mode bare`:
Command `run src/scripts/test.move --args 0u8 --mode bare --dry-run`:
Command `run src/scripts/test.move --args 1u8 --mode bare --dry-run`:
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
publish src/modules --mode bare
run src/scripts/test.move --args 0u8 --mode bare --dry-run
run src/scripts/test.move --args 1u8 --mode bare --dry-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
address 0x42 {
module M {
public fun test(x: u8) {
if (x == 0) {
return ()
} else {
return ()
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
script {
use 0x42::M;

fun main(x: u8) {
M::test(x);
}
}

0 comments on commit 676934d

Please sign in to comment.