use std::path::{Path, PathBuf};
use std::process::Command;
use test_better::prelude::*;
fn fixture_dir(name: &str) -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("fixtures")
.join(name)
}
#[test]
fn reports_the_run_summary_counts_and_propagates_the_exit_code() -> TestResult {
let dir = fixture_dir("mixed-results");
let output = Command::new(env!("CARGO_BIN_EXE_cargo-test-better"))
.current_dir(&dir)
.output()
.or_fail_with("spawn the cargo-test-better binary")?;
let stdout = String::from_utf8(output.stdout).or_fail_with("runner stdout is utf-8")?;
check!(output.status.success()).satisfies(is_false())?;
let summary = stdout
.split_once("test-better: summary")
.or_fail_with("the runner printed its summary table")?
.1;
check!(summary.contains("3 passed, 2 failed, 1 ignored")).satisfies(is_true())?;
check!(summary.contains("finished in")).satisfies(is_true())
}