Skip to content

Commit

Permalink
contracts: make test work with debugger (paritytech#13776)
Browse files Browse the repository at this point in the history
* contracts: make test work with debugger

* fix path

* PR review

* Add comment

* space

* Update frame/contracts/src/tests.rs

* lint

* spelling
  • Loading branch information
pgherveou authored Mar 31, 2023
1 parent a7bc9c2 commit 75dee3c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 75dee3c

Please sign in to comment.