use std::fs;
use std::process::Command;
use std::str;
#[test]
fn test_command_remove_dry_run() {
let output = Command::new(env!("CARGO_BIN_EXE_haj"))
.arg("remove")
.arg("--dry-run")
.arg("dummy_pkg")
.output()
.expect("Failed to execute haj");
let _stdout = str::from_utf8(&output.stdout).unwrap();
assert!(output.status.success() || str::from_utf8(&output.stderr).unwrap().contains("error:"));
}
#[test]
fn test_command_clean_dry_run() {
let output = Command::new(env!("CARGO_BIN_EXE_haj"))
.arg("clean")
.arg("--help")
.output()
.expect("Failed to execute haj");
assert!(output.status.success());
}
#[test]
fn test_command_mark() {
let output = Command::new(env!("CARGO_BIN_EXE_haj"))
.arg("mark")
.arg("--help")
.output()
.expect("Failed to execute haj");
assert!(output.status.success());
}
#[test]
fn test_command_history() {
let mut path = std::env::temp_dir();
path.push("haj_test_history");
let _ = fs::create_dir_all(&path);
let output = Command::new(env!("CARGO_BIN_EXE_haj"))
.arg("--root")
.arg(&path)
.arg("history")
.output()
.expect("Failed to execute haj");
assert!(output.status.success());
}