use crate::testing::*;
use assertables::*;
use once_cell::sync::Lazy;
use std::path::PathBuf;
pub static DIR: Lazy<PathBuf> =
Lazy::new(|| crate::testing::TESTS_DIR.join("command").join("template"));
#[test]
fn test() {
let template: PathBuf = DIR.join("custom-template-file-name.html");
let input: PathBuf = DIR.join("example.md");
let output: PathBuf = DIR.join("example.html");
let expect: PathBuf = DIR.join("example.html=expect.html");
assert!(input.exists(), "input path: {:?}", input);
assert!(template.exists(), "template path: {:?}", template);
assert!(expect.exists(), "expect path: {:?}", expect);
assert_ok!(remove_file_if_exists(&output));
assert!(!output.exists(), "!output.exists() path: {:?}", output);
let command_result = std::process::Command::new(&*COMMAND_OS)
.arg("--input")
.arg(input.as_os_str())
.arg("--output")
.arg(output.as_os_str())
.arg("--template")
.arg(template.as_os_str())
.output();
assert_ok!(command_result);
assert!(output.exists(), "output.exists() path: {:?}", output);
assert_fs_read_to_string_eq!(&output, &expect);
assert_ok!(remove_file_if_exists(&output));
}