forked from foundry-rs/foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.rs
29 lines (24 loc) · 939 Bytes
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
mod runner;
pub use runner::{ContractRunner, TestKind, TestKindGas, TestResult};
mod multi_runner;
pub use multi_runner::{MultiContractRunner, MultiContractRunnerBuilder};
use ethers::abi;
use eyre::Result;
pub fn decode_revert(error: &[u8]) -> Result<String> {
Ok(abi::decode(&[abi::ParamType::String], &error[4..])?[0].to_string())
}
#[cfg(test)]
pub mod test_helpers {
use ethers::{
prelude::Lazy,
solc::{CompilerOutput, Project, ProjectPathsConfig},
};
pub static COMPILED: Lazy<CompilerOutput> = Lazy::new(|| {
// NB: should we add a test-helper function that makes creating these
// ephemeral projects easier?
let paths =
ProjectPathsConfig::builder().root("testdata").sources("testdata").build().unwrap();
let project = Project::builder().paths(paths).ephemeral().no_artifacts().build().unwrap();
project.compile().unwrap().output()
});
}