Skip to content

Commit

Permalink
test: cache global template build at initialization (#6299)
Browse files Browse the repository at this point in the history
* test: cache global template build at initialization

* chore: remove pragmas from test sources

* chore: route all pragma soliditys through TestProject

* test: only use a single Solc version

* test: restore pragma in can_test_pre_bytecode_hash

* comment

* regex fixes

* fix regex 2
  • Loading branch information
DaniPopes authored Nov 13, 2023
1 parent b205b6a commit b3ea19a
Show file tree
Hide file tree
Showing 31 changed files with 541 additions and 653 deletions.
6 changes: 3 additions & 3 deletions crates/common/src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,16 @@ impl Reporter for SpinnerReporter {

/// Invoked before a new [`Solc`] bin is installed
fn on_solc_installation_start(&self, version: &Version) {
self.send_msg(format!("Installing solc version {version}"));
self.send_msg(format!("Installing Solc version {version}"));
}

/// Invoked before a new [`Solc`] bin was successfully installed
fn on_solc_installation_success(&self, version: &Version) {
self.send_msg(format!("Successfully installed solc {version}"));
self.send_msg(format!("Successfully installed Solc {version}"));
}

fn on_solc_installation_error(&self, version: &Version, error: &str) {
self.send_msg(Paint::red(format!("Failed to install solc {version}: {error}")).to_string());
self.send_msg(Paint::red(format!("Failed to install Solc {version}: {error}")).to_string());
}

fn on_unresolved_imports(&self, imports: &[(&Path, &Path)], remappings: &[Remapping]) {
Expand Down
8 changes: 4 additions & 4 deletions crates/forge/tests/cli/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ forgetest!(can_list_specific_chain, |_prj, cmd| {
});

forgetest_init!(can_test_no_cache, |prj, cmd| {
let _ = std::fs::remove_dir_all(prj.cache_path());
prj.clear_cache();

cmd.args(["test", "--no-cache"]).assert_success();
assert!(!prj.cache_path().exists(), "cache file should not exist");
assert!(!prj.cache().exists(), "cache file should not exist");

cmd.forge_fuse().args(["test"]).assert_success();
assert!(prj.cache_path().exists(), "cache file should exist");
cmd.forge_fuse().arg("test").assert_success();
assert!(prj.cache().exists(), "cache file should exist");
});
Loading

0 comments on commit b3ea19a

Please sign in to comment.