fix tests for windows

This commit is contained in:
sagie gur ari 2020-03-06 16:04:56 +00:00
parent cfb3a0c7bc
commit 000070e457

View file

@ -1,7 +1,5 @@
use super::*; use super::*;
use crate::test; use crate::test;
use crate::test::CommandValidation;
use fsio::file::ensure_exists;
#[test] #[test]
fn common_functions() { fn common_functions() {
@ -18,15 +16,21 @@ fn run_no_path_provided() {
test::run_script_and_error(vec![create("")], "out = chmod 755", "out"); test::run_script_and_error(vec![create("")], "out = chmod 755", "out");
} }
#[cfg(any(target_os = "redox", unix, target_os = "vxworks"))] cfg_if::cfg_if! {
#[test] if #[cfg(any(target_os = "redox", unix, target_os = "vxworks"))] {
fn run_single_file_unix() { use crate::test::CommandValidation;
let result = ensure_exists("./target/_duckscript/chmod/file.txt"); use fsio::file::ensure_exists;
assert!(result.is_ok());
test::run_script_and_validate( #[test]
vec![create("")], fn run_single_file_unix() {
"out = chmod 777 ./target/_duckscript/chmod/file.txt", let result = ensure_exists("./target/_duckscript/chmod/file.txt");
CommandValidation::Match("out".to_string(), "511".to_string()), assert!(result.is_ok());
);
test::run_script_and_validate(
vec![create("")],
"out = chmod 777 ./target/_duckscript/chmod/file.txt",
CommandValidation::Match("out".to_string(), "511".to_string()),
);
}
}
} }