Skip to content

Commit

Permalink
[test] fix testing failures relate to 0x0x (#31)
Browse files Browse the repository at this point in the history
* fix testing failures relate to 0x0x

* cleanup

* cleanup
  • Loading branch information
jiangying000 authored Sep 23, 2022
1 parent 7871d83 commit c24e339
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn call_non_existent_function() {
let code = r#"
module {{ADDR}}::M {}
"#;
let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));

let mut units = compile_units(&code).unwrap();
let m = as_module(units.pop().unwrap());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn test_malformed_resource() {
}
}
"#;
let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));
let mut units = compile_units(&code).unwrap();

let s2 = as_script(units.pop().unwrap());
Expand Down Expand Up @@ -160,7 +160,7 @@ fn test_malformed_module() {
}
"#;

let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));
let mut units = compile_units(&code).unwrap();

let m = as_module(units.pop().unwrap());
Expand Down Expand Up @@ -214,7 +214,7 @@ fn test_unverifiable_module() {
}
"#;

let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));
let mut units = compile_units(&code).unwrap();
let m = as_module(units.pop().unwrap());

Expand Down Expand Up @@ -273,7 +273,7 @@ fn test_missing_module_dependency() {
public fun bar() { M::foo(); }
}
"#;
let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));
let mut units = compile_units(&code).unwrap();
let n = as_module(units.pop().unwrap());
let m = as_module(units.pop().unwrap());
Expand Down Expand Up @@ -320,7 +320,7 @@ fn test_missing_module_dependency() {
}

#[test]
fn test_malformed_module_denpency() {
fn test_malformed_module_dependency() {
// Compile two modules M, N where N depends on M.
let code = r#"
module {{ADDR}}::M {
Expand All @@ -333,7 +333,7 @@ fn test_malformed_module_denpency() {
public fun bar() { M::foo(); }
}
"#;
let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));
let mut units = compile_units(&code).unwrap();
let n = as_module(units.pop().unwrap());
let m = as_module(units.pop().unwrap());
Expand Down Expand Up @@ -399,7 +399,7 @@ fn test_unverifiable_module_dependency() {
public fun bar() { M::foo(); }
}
"#;
let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));
let mut units = compile_units(&code).unwrap();
let n = as_module(units.pop().unwrap());
let m = as_module(units.pop().unwrap());
Expand Down Expand Up @@ -534,7 +534,7 @@ fn test_storage_returns_bogus_error_when_loading_resource() {
}
}
"#;
let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));

let mut units = compile_units(&code).unwrap();
let m = as_module(units.pop().unwrap());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn run(

let code = format!(
r#"
module 0x{}::M {{
module {}::M {{
struct Foo has copy, drop {{ x: u64 }}
struct Bar<T> has copy, drop {{ x: T }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn mutated_accounts() {
}
"#;

let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let code = code.replace("{{ADDR}}", &format!("{}", TEST_ADDR));
let mut units = compile_units(&code).unwrap();
let m = as_module(units.pop().unwrap());
let mut blob = vec![];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn run(

let code = format!(
r#"
module 0x{}::M {{
module {}::M {{
{}
fun foo{} {{
Expand Down

0 comments on commit c24e339

Please sign in to comment.