#![cfg(test)]
pub(crate) fn pass() -> Vec<String> {
if cfg!(windows) {
vec!["cmd".into(), "/C".into(), "exit 0".into()]
} else {
vec!["true".into()]
}
}
pub(crate) fn fail() -> Vec<String> {
if cfg!(windows) {
vec!["cmd".into(), "/C".into(), "exit 1".into()]
} else {
vec!["false".into()]
}
}
pub(crate) fn files_exist(files: &[&str]) -> Vec<String> {
if cfg!(windows) {
let mut script = String::new();
for f in files {
script.push_str(&format!("if not exist {f} exit 1 & "));
}
script.push_str("exit 0");
vec!["cmd".into(), "/C".into(), script]
} else {
let test = files
.iter()
.map(|f| format!("test -f {f}"))
.collect::<Vec<_>>()
.join(" && ");
vec!["sh".into(), "-c".into(), test]
}
}