From 5db9d92642898ee1505c817cb51e213b5b15b79c Mon Sep 17 00:00:00 2001
From: Federico Terzi <federicoterzi96@gmail.com>
Date: Fri, 13 Dec 2019 22:33:35 +0100
Subject: [PATCH] Fix shell extension tests on Windows

---
 src/extension/shell.rs | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/extension/shell.rs b/src/extension/shell.rs
index 113f5d7..aa1012a 100644
--- a/src/extension/shell.rs
+++ b/src/extension/shell.rs
@@ -93,7 +93,12 @@ mod tests {
         let output = extension.calculate(&params);
 
         assert!(output.is_some());
-        assert_eq!(output.unwrap(), "hello world\n");
+
+        if cfg!(target_os = "windows") {
+            assert_eq!(output.unwrap(), "hello world\r\n");
+        }else{
+            assert_eq!(output.unwrap(), "hello world\n");
+        }
     }
 
     #[test]
@@ -112,7 +117,12 @@ mod tests {
     #[test]
     fn test_shell_trimmed_2() {
         let mut params = Mapping::new();
-        params.insert(Value::from("cmd"), Value::from("echo \"   hello world     \""));
+        if cfg!(target_os = "windows") {
+            params.insert(Value::from("cmd"), Value::from("echo    hello world     "));
+        }else{
+            params.insert(Value::from("cmd"), Value::from("echo \"   hello world     \""));
+        }
+
         params.insert(Value::from("trim"), Value::from(true));
 
         let extension = ShellExtension::new();
@@ -132,7 +142,11 @@ mod tests {
         let output = extension.calculate(&params);
 
         assert!(output.is_some());
-        assert_eq!(output.unwrap(), "hello world\n");
+        if cfg!(target_os = "windows") {
+            assert_eq!(output.unwrap(), "hello world\r\n");
+        }else{
+            assert_eq!(output.unwrap(), "hello world\n");
+        }
     }
 
     #[test]