use assert_cmd::Command;
use std::fs;
type TestResult = Result<(), Box<dyn std::error::Error>>;
const CLI: &str = "transr";
#[test]
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(())
}