Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-crate testdata #965

Merged
merged 4 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/test-utils/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl TestProject {

/// Adds DSTest as a source under "test.sol"
pub fn insert_ds_test(&self) -> PathBuf {
let s = include_str!("../../../forge/testdata/DsTest.sol");
let s = include_str!("../../../testdata/lib/ds-test/src/test.sol");
self.inner().add_source("test.sol", s).unwrap()
}

Expand Down
32 changes: 0 additions & 32 deletions cli/testdata/run_test.sol

This file was deleted.

38 changes: 0 additions & 38 deletions cli/testdata/run_test_lib_linking.sol

This file was deleted.

2 changes: 1 addition & 1 deletion evm/src/executor/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::{
Executor,
};

#[derive(Default)]
#[derive(Default, Debug)]
pub struct ExecutorBuilder {
/// The execution environment configuration.
env: Env,
Expand Down
1 change: 0 additions & 1 deletion evm/src/executor/inspector/cheatcodes/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ fn get_code(path: &str) -> Result<Bytes, Bytes> {
let file = parts[0];
let contract_name =
if parts.len() == 1 { parts[0].replace(".sol", "") } else { parts[1].to_string() };

let out_dir = ProjectPathsConfig::find_artifacts_dir(Path::new("./"));
out_dir.join(format!("{}/{}.json", file, contract_name))
};
Expand Down
2 changes: 1 addition & 1 deletion evm/src/executor/inspector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub use stack::InspectorStack;
mod cheatcodes;
pub use cheatcodes::Cheatcodes;

#[derive(Default, Clone)]
#[derive(Default, Clone, Debug)]
pub struct InspectorStackConfig {
/// Whether or not cheatcodes are enabled
pub cheatcodes: bool,
Expand Down
2 changes: 1 addition & 1 deletion evm/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl fmt::Display for CallTrace {
}

/// Specifies the kind of trace.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum TraceKind {
Deployment,
Setup,
Expand Down
12 changes: 10 additions & 2 deletions forge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub mod test_helpers {
use ethers::{
prelude::Lazy,
solc::{AggregatedCompilerOutput, Project, ProjectPathsConfig},
types::U256,
types::{Address, U256},
};
use foundry_evm::{
executor::{
Expand All @@ -35,6 +35,7 @@ pub mod test_helpers {
fuzz::FuzzedExecutor,
CALLER,
};
use std::str::FromStr;

pub static COMPILED: Lazy<AggregatedCompilerOutput> = Lazy::new(|| {
let paths =
Expand All @@ -44,8 +45,15 @@ pub mod test_helpers {
});

pub static EVM_OPTS: Lazy<EvmOpts> = Lazy::new(|| EvmOpts {
env: Env { gas_limit: 18446744073709551615, chain_id: Some(99), ..Default::default() },
env: Env {
gas_limit: 18446744073709551615,
chain_id: Some(99),
tx_origin: Address::from_str("00a329c0648769a73afac7f9381e08fb43dbea72").unwrap(),
..Default::default()
},
sender: Address::from_str("00a329c0648769a73afac7f9381e08fb43dbea72").unwrap(),
initial_balance: U256::MAX,
ffi: true,
..Default::default()
});

Expand Down
Loading