diff --git a/crates/solidity/testing/sanctuary/src/datasets.rs b/crates/solidity/testing/sanctuary/src/datasets.rs index d776c96186..08666f73cf 100644 --- a/crates/solidity/testing/sanctuary/src/datasets.rs +++ b/crates/solidity/testing/sanctuary/src/datasets.rs @@ -61,6 +61,13 @@ impl DataSet { } pub fn checkout_directory(&self, directory: &str) -> Result<&Vec> { + // Make sure to reset any local changes, in case some were made during local development/debugging: + Command::new("git") + .arg("reset") + .flag("--hard") + .current_dir(&self.repo_dir) + .run()?; + let relative_path = format!("contracts/{network}/{directory}", network = self.network); Command::new("git") diff --git a/crates/solidity/testing/sanctuary/src/events.rs b/crates/solidity/testing/sanctuary/src/events.rs index 1c051520bd..93d67b3634 100644 --- a/crates/solidity/testing/sanctuary/src/events.rs +++ b/crates/solidity/testing/sanctuary/src/events.rs @@ -2,6 +2,7 @@ use std::cmp; use console::Color; use indicatif::ProgressBar; +use infra_utils::github::GitHub; use crate::reporting::Reporter; @@ -82,7 +83,10 @@ impl Events { self.all_directories.inc(1); self.reporter.hide(); - self.reporter.print_full_report(); + + GitHub::collapse_group("Statistics:", || { + self.reporter.print_full_report(); + }); } pub fn test(&self, outcome: TestOutcome) { diff --git a/crates/solidity/testing/sanctuary/src/reporting.rs b/crates/solidity/testing/sanctuary/src/reporting.rs index 982668c978..699b8cb8e4 100644 --- a/crates/solidity/testing/sanctuary/src/reporting.rs +++ b/crates/solidity/testing/sanctuary/src/reporting.rs @@ -68,8 +68,10 @@ impl Reporter { self.parent.set_draw_target(ProgressDrawTarget::hidden()); std::io::stdout() - .write_all(&buffer.contents_formatted()[..]) + .write_all(buffer.contents_formatted().as_slice()) .unwrap(); + + println!(); } pub fn add_blank(&mut self) { diff --git a/crates/solidity/testing/sanctuary/src/tests.rs b/crates/solidity/testing/sanctuary/src/tests.rs index 0432d82327..1942151af2 100644 --- a/crates/solidity/testing/sanctuary/src/tests.rs +++ b/crates/solidity/testing/sanctuary/src/tests.rs @@ -73,7 +73,11 @@ pub fn run_test(file: &SourceFile, events: &Events) -> Result<()> { let source = file .path .read_to_string()? + // Some files are null terminated. Remove the null character: + // https://github.com/tintinweb/smart-contract-sanctuary/issues/30 + .trim_end_matches('\0') // Remove unicode character inserted by sanctuary (illegal in Solidity): + // https://github.com/tintinweb/smart-contract-sanctuary/issues/31 .replace("[email protected]", "[email-protected]"); let language = Language::new(version.to_owned())?;