Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 75dee3c

Browse files
authored
contracts: make test work with debugger (#13776)
* contracts: make test work with debugger * fix path * PR review * Add comment * space * Update frame/contracts/src/tests.rs * lint * spelling
1 parent a7bc9c2 commit 75dee3c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: frame/contracts/src/tests.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,14 @@ fn compile_module<T>(fixture_name: &str) -> wat::Result<(Vec<u8>, <T::Hashing as
456456
where
457457
T: frame_system::Config,
458458
{
459-
let fixture_path = ["fixtures/", fixture_name, ".wat"].concat();
459+
let fixture_path = [
460+
// When `CARGO_MANIFEST_DIR` is not set, Rust resolves relative paths from the root folder
461+
std::env::var("CARGO_MANIFEST_DIR").as_deref().unwrap_or("frame/contracts"),
462+
"/fixtures/",
463+
fixture_name,
464+
".wat",
465+
]
466+
.concat();
460467
let wasm_binary = wat::parse_file(fixture_path)?;
461468
let code_hash = T::Hashing::hash(&wasm_binary);
462469
Ok((wasm_binary, code_hash))

0 commit comments

Comments
 (0)