use assert_cmd::Command; // use predicates::prelude::*; use std::fs; // use tempfile::NamedTempFile; type TestResult = Result<(), Box>; const CLI: &str = "transr"; // -------------------------------------------------- #[test] // should succeed as the repo ships with csv and xml folder by default; fn zero() -> TestResult { Command::cargo_bin(CLI)?.assert().success(); Ok(()) } // -------------------------------------------------- #[test] fn one() -> TestResult { let args = ["-c", "tests/1/input.csv", "-x", "tests/1/xml", "-d"]; let expected = "tests/1/result.o"; run(&args, &expected) } fn run(args: &[&str], expected_file: &str) -> TestResult { let expected = fs::read_to_string(expected_file)?; Command::cargo_bin(CLI)? .args(args) .assert() .success() .stdout(expected); Ok(()) }