From cdd8a7b91aeb7bf44fcf75c3b216d4785fbb4f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Sun, 11 Apr 2021 04:32:48 +1200 Subject: [PATCH] Fix process test and add more for windows --- src/process.rs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/process.rs b/src/process.rs index 82ce63a..cb2f1ec 100644 --- a/src/process.rs +++ b/src/process.rs @@ -523,6 +523,7 @@ fn get_longest_common_path(paths: &[PathBuf]) -> Option { #[cfg(test)] #[cfg(target_family = "unix")] mod tests { + use super::Shell; use crate::pathop::PathOp; use std::collections::HashSet; use std::path::PathBuf; @@ -533,7 +534,7 @@ mod tests { #[test] fn test_start() { - let _ = spawn(&["echo".into(), "hi".into()], &[], true, false); + let _ = spawn(&["echo".into(), "hi".into()], &[], Shell::default(), false); } #[test] @@ -609,10 +610,30 @@ mod tests { #[cfg(test)] #[cfg(target_family = "windows")] mod tests { - use super::spawn; + use super::{spawn, Shell}; #[test] - fn test_start() { - let _ = spawn(&["echo".into(), "hi".into()], &[], true, false); + fn test_default() { + let _ = spawn(&["echo".into(), "hi".into()], &[], Shell::default(), false); + } + + #[test] + fn test_cmd() { + let _ = spawn(&["echo".into(), "hi".into()], &[], Shell::Cmd, false); + } + + #[test] + fn test_powershell() { + let _ = spawn(&["echo".into(), "hi".into()], &[], Shell::Powershell, false); + } + + #[test] + fn test_bash() { + let _ = spawn( + &["echo".into(), "hi".into()], + &[], + Shell::Unix("bash".into()), + false, + ); } }