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

sanctuary fixes #855

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions crates/solidity/testing/sanctuary/src/datasets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ impl DataSet {
}

pub fn checkout_directory(&self, directory: &str) -> Result<&Vec<SourceFile>> {
// Make sure to reset any local changes, in case some were made during local development/debugging:
Command::new("git")
Xanewok marked this conversation as resolved.
Show resolved Hide resolved
.arg("reset")
.flag("--hard")
.current_dir(&self.repo_dir)
.run()?;

let relative_path = format!("contracts/{network}/{directory}", network = self.network);

Command::new("git")
Expand Down
6 changes: 5 additions & 1 deletion crates/solidity/testing/sanctuary/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::cmp;

use console::Color;
use indicatif::ProgressBar;
use infra_utils::github::GitHub;

use crate::reporting::Reporter;

Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion crates/solidity/testing/sanctuary/src/reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions crates/solidity/testing/sanctuary/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())?;
Expand Down
Loading