Skip to content

Commit

Permalink
feat: some very basic testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dnbln committed Feb 3, 2024
1 parent 0b29122 commit 1b95d58
Show file tree
Hide file tree
Showing 7 changed files with 665 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn rerunner(invocation: TestRerunnerInvocation) -> Result<(), Error> {
child_stdout.read_to_string(&mut stdout)?;
child_stderr.read_to_string(&mut stderr)?;

print!("{stdout}");
println!("{stdout}");
eprintln!("{stderr}");

std::process::exit(1);
Expand Down
12 changes: 9 additions & 3 deletions cargo-difftests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use cargo_difftests::{
use clap::{Args, Parser, ValueEnum};
use log::{info, warn};
use prodash::render::line;
use prodash::tree::Root as Tree;
use prodash::tree::{Item, Root as Tree};
use prodash::unit;

#[derive(Args, Debug)]
Expand Down Expand Up @@ -527,7 +527,7 @@ impl AnalyzeAllActionArgs {
return Ok(());
}

let mut pb = ctxt.shell.tree.add_child("Rerunning dirty tests");
let mut pb = ctxt.new_child("Rerunning dirty tests");
pb.init(Some(1), Some(unit::label("test sets")));

let invocation_str = serde_json::to_string(&invocation)?;
Expand Down Expand Up @@ -1274,7 +1274,7 @@ pub fn run_analyze_all(

let mut results = vec![];

let mut pb = ctxt.shell.tree.add_child("Analyzing tests");
let mut pb = ctxt.new_child("Analyzing tests");
pb.init(Some(discovered.len()), Some(unit::label("difftests")));

for mut difftest in discovered.into_iter() {
Expand Down Expand Up @@ -1377,6 +1377,12 @@ pub struct CargoDifftestsContext {
shell: Shell,
}

impl CargoDifftestsContext {
pub fn new_child(&self, label: &str) -> Item {
self.shell.tree.add_child(label)
}
}

fn main_impl() -> CargoDifftestsResult {
pretty_env_logger::formatted_builder()
.parse_env("CARGO_DIFFTESTS_LOG")
Expand Down
Loading

0 comments on commit 1b95d58

Please sign in to comment.