I'm learning Move language and I'd like to run tests to make sure my module is valid. Here is example taken from docs (file sources/MyModule.move
):
module 0xCAFE::BasicCoin {
#[test_only]
use std::signer;
struct Coin has key {
value: u64,
}
public fun mint(account: signer, value: u64) {
move_to(&account, Coin { value })
}
#[test(account = @0xC0FFEE)]
fun test_mint_10(account: signer) acquires Coin {
let addr = signer::address_of(&account);
mint(account, 10);
assert(borrow_global<Coin>(addr).value == 10, 0);
}
}
Documentation says I need to start tests using
cargo run --bin move-unit-test MyModule.move
But I cannot since I get
error: could not find `Cargo.toml` in `.../move-playground` or any parent directory
If I launch tests using move sandbox test sources/MyModule.move
then I will get no tests executed:
0 / 0 test(s) passed.
How shall one start tests?