Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zekun Wang committed May 23, 2024
1 parent e406711 commit 3bc6e61
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 0 deletions.
8 changes: 8 additions & 0 deletions third_party/move/tools/move-package/tests/test_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use tempfile::tempdir;

const COMPILE_EXT: &str = "compile";
const MODEL_EXT: &str = "model";
const OVERRIDE_EXT: &str = "override";

fn run_test_impl(
path: &Path,
Expand All @@ -39,6 +40,12 @@ fn run_test_impl(
..Default::default()
};
compiler_config.compiler_version = Some(compiler_version);
let override_path = path.with_extension(OVERRIDE_EXT);
let override_std = if override_path.is_file() {
Some(fs::read_to_string(override_path)?)
} else {
None
};
let should_compile = path.with_extension(COMPILE_EXT).is_file();
let should_model = path.with_extension(MODEL_EXT).is_file();
let contents = fs::read_to_string(path)?;
Expand All @@ -51,6 +58,7 @@ fn run_test_impl(
BuildConfig {
dev_mode: true,
test_mode: false,
override_std,
generate_docs: false,
generate_abis: false,
install_dir: Some(tempdir().unwrap().path().to_path_buf()),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unable to resolve packages for package 'std-lib-conflicts': While resolving dependency 'B' in package 'std-lib-conflicts': Unable to resolve package dependency 'B': While resolving dependency 'AptosFramework' in package 'B': Unable to resolve package dependency 'AptosFramework': Conflicting dependencies found: package 'AptosFramework' conflicts with 'AptosFramework'
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "std-lib-conflicts"
version = "1.0.0"
authors = []

[addresses]
A = "0x42"

[dev-addresses]

[dependencies.AptosFramework]
git = "https://github.com/aptos-labs/aptos-core.git"
rev = "devnet"
subdir = "aptos-move/framework/aptos-framework"

[dependencies.B]
local = "./deps_only"

[dev-dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "B"
version = "1.0.0"
authors = []

[addresses]
B = "0x43"

[dev-addresses]

[dependencies.AptosFramework]
git = "https://github.com/aptos-labs/aptos-core.git"
rev = "mainnet"
subdir = "aptos-move/framework/aptos-framework"

[dev-dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module B::B {
public fun foo() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module A::A {
use B::B;
public fun foo() {
B::foo();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
CompiledPackageInfo {
package_name: "std-lib-conflicts",
address_alias_instantiation: {
"A": 0000000000000000000000000000000000000000000000000000000000000042,
"B": 0000000000000000000000000000000000000000000000000000000000000043,
"Extensions": 0000000000000000000000000000000000000000000000000000000000000001,
"aptos_framework": 0000000000000000000000000000000000000000000000000000000000000001,
"aptos_fungible_asset": 000000000000000000000000000000000000000000000000000000000000000a,
"aptos_std": 0000000000000000000000000000000000000000000000000000000000000001,
"aptos_token": 0000000000000000000000000000000000000000000000000000000000000003,
"core_resources": 000000000000000000000000000000000000000000000000000000000a550c18,
"std": 0000000000000000000000000000000000000000000000000000000000000001,
"vm": 0000000000000000000000000000000000000000000000000000000000000000,
"vm_reserved": 0000000000000000000000000000000000000000000000000000000000000000,
},
source_digest: Some(
"ELIDED_FOR_TEST",
),
build_flags: BuildConfig {
dev_mode: true,
test_mode: false,
override_std: Some(
"devnet",
),
generate_docs: false,
generate_abis: false,
generate_move_model: false,
full_model_generation: false,
install_dir: Some(
"ELIDED_FOR_TEST",
),
force_recompilation: false,
additional_named_addresses: {},
architecture: None,
fetch_deps_only: false,
skip_fetch_latest_git_deps: false,
compiler_config: CompilerConfig {
bytecode_version: None,
known_attributes: {
"bytecode_instruction",
"deprecated",
"expected_failure",
"native_interface",
"test",
"test_only",
"verify_only",
},
skip_attribute_checks: false,
compiler_version: Some(
V1,
),
language_version: None,
},
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
devnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "std-lib-conflicts"
version = "1.0.0"
authors = []

[addresses]
A = "0x42"

[dev-addresses]

[dependencies.AptosFramework]
git = "https://github.com/aptos-labs/aptos-core.git"
rev = "devnet"
subdir = "aptos-move/framework/aptos-framework"

[dependencies.B]
local = "./deps_only"

[dev-dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "B"
version = "1.0.0"
authors = []

[addresses]
B = "0x43"

[dev-addresses]

[dependencies.AptosFramework]
git = "https://github.com/aptos-labs/aptos-core.git"
rev = "mainnet"
subdir = "aptos-move/framework/aptos-framework"

[dev-dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module B::B {
public fun foo() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module A::A {
use B::B;
public fun foo() {
B::foo();
}
}

0 comments on commit 3bc6e61

Please sign in to comment.