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
This commit is contained in:
PG Herveou
2023-03-31 19:44:29 +02:00
committed by GitHub
parent 2a44372ea1
commit 8d802eece0
+8 -1
View File
@@ -456,7 +456,14 @@ fn compile_module<T>(fixture_name: &str) -> wat::Result<(Vec<u8>, <T::Hashing as
where
T: frame_system::Config,
{
let fixture_path = ["fixtures/", fixture_name, ".wat"].concat();
let fixture_path = [
// When `CARGO_MANIFEST_DIR` is not set, Rust resolves relative paths from the root folder
std::env::var("CARGO_MANIFEST_DIR").as_deref().unwrap_or("frame/contracts"),
"/fixtures/",
fixture_name,
".wat",
]
.concat();
let wasm_binary = wat::parse_file(fixture_path)?;
let code_hash = T::Hashing::hash(&wasm_binary);
Ok((wasm_binary, code_hash))