use std::process::Command; use assert_cmd::prelude::*; use predicates::prelude::*; use tempfile::NamedTempFile; #[test] fn gen() -> Result<(), Box> { let mut cmd = Command::cargo_bin("treeedbgen-souffle-rust")?; let tmp = NamedTempFile::new()?; cmd.arg("-o").arg(tmp.path()); cmd.arg("--prefix=rust").arg("--printsize"); cmd.assert() .success() .stdout(predicate::str::is_empty()) .stderr(predicate::str::is_empty()); let mut cmd = Command::cargo_bin("treeedb-rust")?; cmd.arg("tests/rs/hello-world.rs"); cmd.assert() .success() .stdout(predicate::str::is_empty()) .stderr(predicate::str::is_empty()); let mut souffle = Command::new("souffle"); souffle.arg(tmp.path()); souffle .assert() .success() .stdout(predicate::str::contains("rust_node\t10")) .stderr(predicate::str::is_empty()); Ok(()) }