这是indexloc提供的服务,不要输入任何密码
Skip to content

sui move test bug #22640

@FrankC01

Description

@FrankC01

Using devnet sui binaries sui 1.52.0-069e0269af84
I deleted ~/.move

I have the following in a test file:

#[test_only]
module movetz::movetz_tests;
use movetz::movetz;
use sui::test_scenario::{Self,return_shared};

const ENotImplemented: u64 = 0;

#[test]
fun test_module_init() {

    // Create test addresses representing users
    let admin = @0xAD;

    // First transaction to emulate module initialization
    let mut scenario = test_scenario::begin(admin);
    {
            movetz::drive_init(scenario.ctx());
    };
    scenario.end();
}

Run: sui move test

Output

fastfrank@~/frankc01/movetz $ sui move test
INCLUDING DEPENDENCY Bridge
INCLUDING DEPENDENCY SuiSystem
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING movetz
Running Move unit tests
[ FAIL    ] movetz::movetz_tests::test_module_init
[ PASS    ] movetz::movetz_tests::test_movetz_fail

Test failures:

Failures in movetz::movetz_tests:

┌── test_module_init ──────
│ error[E11001]: test failure
│     ┌─ /Users/fastfrank/.move/https___github_com_MystenLabs_sui_git_2c930c25f8d3/crates/sui-framework/packages/sui-framework/sources/tx_context.move:196:12
│     │
│ 196 │ native fun replace(
│     │            ^^^^^^^
│     │            │
│     │            INTERNAL TEST ERROR: INTERNAL VM INVARIANT VIOLATION.
│ Test was not expected to error, but it gave a INTERNAL_TYPE_ERROR (code 2009) error originating in the module sui::tx_context rooted here
│     │            In this function in sui::tx_context
│
│
│ stack trace
│ 	tx_context::new_from_hint(/Users/fastfrank/.move/https___github_com_MystenLabs_sui_git_2c930c25f8d3/crates/sui-framework/packages/sui-framework/sources/tx_context.move:127)
│ 	test_scenario::begin(/Users/fastfrank/.move/https___github_com_MystenLabs_sui_git_2c930c25f8d3/crates/sui-framework/packages/sui-framework/sources/test/test_scenario.move:102)
│ 	movetz_tests::test_module_init(./tests/movetz_tests.move:15)
│
└──────────────────

Test result: FAILED. Total tests: 2; passed: 1; failed: 1

However; if I add this in my otherwise empty [dependencies] in Move.toml it works

Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/devnet" }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions