From 000070e4575ebd6b97cfaf11af421326a1c206bf Mon Sep 17 00:00:00 2001 From: sagie gur ari Date: Fri, 6 Mar 2020 16:04:56 +0000 Subject: [PATCH] fix tests for windows --- .../src/sdk/std/fs/set_mode/mod_test.rs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/duckscript_sdk/src/sdk/std/fs/set_mode/mod_test.rs b/duckscript_sdk/src/sdk/std/fs/set_mode/mod_test.rs index 6681cb5..c5ea123 100644 --- a/duckscript_sdk/src/sdk/std/fs/set_mode/mod_test.rs +++ b/duckscript_sdk/src/sdk/std/fs/set_mode/mod_test.rs @@ -1,7 +1,5 @@ use super::*; use crate::test; -use crate::test::CommandValidation; -use fsio::file::ensure_exists; #[test] fn common_functions() { @@ -18,15 +16,21 @@ fn run_no_path_provided() { test::run_script_and_error(vec![create("")], "out = chmod 755", "out"); } -#[cfg(any(target_os = "redox", unix, target_os = "vxworks"))] -#[test] -fn run_single_file_unix() { - let result = ensure_exists("./target/_duckscript/chmod/file.txt"); - assert!(result.is_ok()); +cfg_if::cfg_if! { + if #[cfg(any(target_os = "redox", unix, target_os = "vxworks"))] { + use crate::test::CommandValidation; + use fsio::file::ensure_exists; - test::run_script_and_validate( - vec![create("")], - "out = chmod 777 ./target/_duckscript/chmod/file.txt", - CommandValidation::Match("out".to_string(), "511".to_string()), - ); + #[test] + fn run_single_file_unix() { + let result = ensure_exists("./target/_duckscript/chmod/file.txt"); + 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()), + ); + } + } }