From 6fe4052ccb902af3fc454a90b1b0e5c33bc721ca Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Thu, 21 Jan 2021 15:18:35 +0100 Subject: [PATCH 1/3] Fix FindOnPathSucceeds failing on some Linux flavors --- src/Utilities.UnitTests/ToolTask_Tests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Utilities.UnitTests/ToolTask_Tests.cs b/src/Utilities.UnitTests/ToolTask_Tests.cs index d8c69b18f9e..822d2c3901f 100644 --- a/src/Utilities.UnitTests/ToolTask_Tests.cs +++ b/src/Utilities.UnitTests/ToolTask_Tests.cs @@ -679,22 +679,22 @@ public void ToolPathIsFoundWhenDirectoryExistsWithNameOfTool() [Fact] public void FindOnPathSucceeds() { - string expectedCmdPath; + string[] expectedCmdPath; string shellName; if (NativeMethodsShared.IsWindows) { - expectedCmdPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "cmd.exe"); + expectedCmdPath = new[] { Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System).ToLower(), "cmd.exe") }; shellName = "cmd.exe"; } else { - expectedCmdPath = "/bin/sh"; + expectedCmdPath = new[] { "/bin/sh", "/usr/bin/sh" }; shellName = "sh"; } - string cmdPath = ToolTask.FindOnPath(shellName); + string cmdPath = ToolTask.FindOnPath(shellName).ToLower(); - cmdPath.ShouldBe(expectedCmdPath, StringCompareShould.IgnoreCase); + cmdPath.ShouldBeOneOf(expectedCmdPath, cmdPath); } /// From b96fd3528da0dcda952d9e7a08646fec563b3bb9 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Thu, 21 Jan 2021 17:34:09 +0100 Subject: [PATCH 2/3] Fix ShouldBeOneOf argument. --- src/Utilities.UnitTests/ToolTask_Tests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utilities.UnitTests/ToolTask_Tests.cs b/src/Utilities.UnitTests/ToolTask_Tests.cs index 822d2c3901f..d4ac4233b3c 100644 --- a/src/Utilities.UnitTests/ToolTask_Tests.cs +++ b/src/Utilities.UnitTests/ToolTask_Tests.cs @@ -694,7 +694,7 @@ public void FindOnPathSucceeds() string cmdPath = ToolTask.FindOnPath(shellName).ToLower(); - cmdPath.ShouldBeOneOf(expectedCmdPath, cmdPath); + cmdPath.ShouldBeOneOf(expectedCmdPath); } /// From 5842a833a0efb437b71e85360552c93d913a6e8b Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Thu, 21 Jan 2021 17:35:10 +0100 Subject: [PATCH 3/3] Remove ToLower --- src/Utilities.UnitTests/ToolTask_Tests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utilities.UnitTests/ToolTask_Tests.cs b/src/Utilities.UnitTests/ToolTask_Tests.cs index d4ac4233b3c..f683c61ca7d 100644 --- a/src/Utilities.UnitTests/ToolTask_Tests.cs +++ b/src/Utilities.UnitTests/ToolTask_Tests.cs @@ -683,7 +683,7 @@ public void FindOnPathSucceeds() string shellName; if (NativeMethodsShared.IsWindows) { - expectedCmdPath = new[] { Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System).ToLower(), "cmd.exe") }; + expectedCmdPath = new[] { Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "cmd.exe") }; shellName = "cmd.exe"; } else @@ -692,7 +692,7 @@ public void FindOnPathSucceeds() shellName = "sh"; } - string cmdPath = ToolTask.FindOnPath(shellName).ToLower(); + string cmdPath = ToolTask.FindOnPath(shellName); cmdPath.ShouldBeOneOf(expectedCmdPath); }