diff --git a/test/PowerShellEditorServices.Test/Extensions/ExtensionCommandTests.cs b/test/PowerShellEditorServices.Test/Extensions/ExtensionCommandTests.cs index 430687f93..613202094 100644 --- a/test/PowerShellEditorServices.Test/Extensions/ExtensionCommandTests.cs +++ b/test/PowerShellEditorServices.Test/Extensions/ExtensionCommandTests.cs @@ -51,7 +51,7 @@ public void Dispose() [Fact] public async Task CanRegisterAndInvokeCommandWithCmdletName() { - string filePath = TestUtilities.NormalizePath("C:\\Temp\\Test.ps1"); + string filePath = TestUtilities.NormalizePath(@"C:\Temp\Test.ps1"); ScriptFile currentFile = new(new Uri(filePath), "This is a test file", new Version("7.0")); EditorContext editorContext = new( editorOperations: null, @@ -87,7 +87,7 @@ await psesHost.ExecutePSCommandAsync( [Fact] public async Task CanRegisterAndInvokeCommandWithScriptBlock() { - string filePath = TestUtilities.NormalizePath("C:\\Temp\\Test.ps1"); + string filePath = TestUtilities.NormalizePath(@"C:\Temp\Test.ps1"); ScriptFile currentFile = new(new Uri(filePath), "This is a test file", new Version("7.0")); EditorContext editorContext = new( editorOperations: null, @@ -149,7 +149,7 @@ await psesHost.ExecutePSCommandAsync( [Fact] public async Task CanUnregisterCommand() { - string filePath = TestUtilities.NormalizePath("C:\\Temp\\Test.ps1"); + string filePath = TestUtilities.NormalizePath(@"C:\Temp\Test.ps1"); ScriptFile currentFile = new(new Uri(filePath), "This is a test file", new Version("7.0")); EditorContext editorContext = new( editorOperations: null, diff --git a/test/PowerShellEditorServices.Test/Session/PathEscapingTests.cs b/test/PowerShellEditorServices.Test/Session/PathEscapingTests.cs index ed591a395..3d4f0d479 100644 --- a/test/PowerShellEditorServices.Test/Session/PathEscapingTests.cs +++ b/test/PowerShellEditorServices.Test/Session/PathEscapingTests.cs @@ -12,17 +12,17 @@ public class PathEscapingTests [Theory] [InlineData("DebugTest.ps1", "DebugTest.ps1")] [InlineData("../../DebugTest.ps1", "../../DebugTest.ps1")] - [InlineData("C:\\Users\\me\\Documents\\DebugTest.ps1", "C:\\Users\\me\\Documents\\DebugTest.ps1")] + [InlineData(@"C:\Users\me\Documents\DebugTest.ps1", @"C:\Users\me\Documents\DebugTest.ps1")] [InlineData("/home/me/Documents/weird&folder/script.ps1", "/home/me/Documents/weird&folder/script.ps1")] [InlineData("./path/with some/spaces", "./path/with some/spaces")] - [InlineData("C:\\path\\with[some]brackets\\file.ps1", "C:\\path\\with`[some`]brackets\\file.ps1")] - [InlineData("C:\\look\\an*\\here.ps1", "C:\\look\\an`*\\here.ps1")] + [InlineData(@"C:\path\with[some]brackets\file.ps1", @"C:\path\with`[some`]brackets\file.ps1")] + [InlineData(@"C:\look\an*\here.ps1", @"C:\look\an`*\here.ps1")] [InlineData("/Users/me/Documents/?here.ps1", "/Users/me/Documents/`?here.ps1")] [InlineData("/Brackets [and s]paces/path.ps1", "/Brackets `[and s`]paces/path.ps1")] [InlineData("/CJK.chars/脚本/hello.ps1", "/CJK.chars/脚本/hello.ps1")] [InlineData("/CJK.chars/脚本/[hello].ps1", "/CJK.chars/脚本/`[hello`].ps1")] - [InlineData("C:\\Animals\\утка\\quack.ps1", "C:\\Animals\\утка\\quack.ps1")] - [InlineData("C:\\&nimals\\утка\\qu*ck?.ps1", "C:\\&nimals\\утка\\qu`*ck`?.ps1")] + [InlineData(@"C:\Animals\утка\quack.ps1", @"C:\Animals\утка\quack.ps1")] + [InlineData(@"C:\&nimals\утка\qu*ck?.ps1", @"C:\&nimals\утка\qu`*ck`?.ps1")] public void CorrectlyWildcardEscapesPathsNoSpaces(string unescapedPath, string escapedPath) { string extensionEscapedPath = PathUtils.WildcardEscapePath(unescapedPath); @@ -33,17 +33,17 @@ public void CorrectlyWildcardEscapesPathsNoSpaces(string unescapedPath, string e [Theory] [InlineData("DebugTest.ps1", "DebugTest.ps1")] [InlineData("../../DebugTest.ps1", "../../DebugTest.ps1")] - [InlineData("C:\\Users\\me\\Documents\\DebugTest.ps1", "C:\\Users\\me\\Documents\\DebugTest.ps1")] + [InlineData(@"C:\Users\me\Documents\DebugTest.ps1", @"C:\Users\me\Documents\DebugTest.ps1")] [InlineData("/home/me/Documents/weird&folder/script.ps1", "/home/me/Documents/weird&folder/script.ps1")] [InlineData("./path/with some/spaces", "./path/with` some/spaces")] - [InlineData("C:\\path\\with[some]brackets\\file.ps1", "C:\\path\\with`[some`]brackets\\file.ps1")] - [InlineData("C:\\look\\an*\\here.ps1", "C:\\look\\an`*\\here.ps1")] + [InlineData(@"C:\path\with[some]brackets\file.ps1", @"C:\path\with`[some`]brackets\file.ps1")] + [InlineData(@"C:\look\an*\here.ps1", @"C:\look\an`*\here.ps1")] [InlineData("/Users/me/Documents/?here.ps1", "/Users/me/Documents/`?here.ps1")] [InlineData("/Brackets [and s]paces/path.ps1", "/Brackets` `[and` s`]paces/path.ps1")] [InlineData("/CJK chars/脚本/hello.ps1", "/CJK` chars/脚本/hello.ps1")] [InlineData("/CJK chars/脚本/[hello].ps1", "/CJK` chars/脚本/`[hello`].ps1")] - [InlineData("C:\\Animal s\\утка\\quack.ps1", "C:\\Animal` s\\утка\\quack.ps1")] - [InlineData("C:\\&nimals\\утка\\qu*ck?.ps1", "C:\\&nimals\\утка\\qu`*ck`?.ps1")] + [InlineData(@"C:\Animal s\утка\quack.ps1", @"C:\Animal` s\утка\quack.ps1")] + [InlineData(@"C:\&nimals\утка\qu*ck?.ps1", @"C:\&nimals\утка\qu`*ck`?.ps1")] public void CorrectlyWildcardEscapesPathsSpaces(string unescapedPath, string escapedPath) { string extensionEscapedPath = PathUtils.WildcardEscapePath(unescapedPath, escapeSpaces: true); diff --git a/test/PowerShellEditorServices.Test/Session/PsesInternalHostTests.cs b/test/PowerShellEditorServices.Test/Session/PsesInternalHostTests.cs index 76f303681..1e141bbc9 100644 --- a/test/PowerShellEditorServices.Test/Session/PsesInternalHostTests.cs +++ b/test/PowerShellEditorServices.Test/Session/PsesInternalHostTests.cs @@ -223,7 +223,7 @@ await psesHost.ExecutePSCommandAsync( [Theory] [InlineData("")] // Regression test for "unset" path. - [InlineData("C:\\Some\\Bad\\Directory")] // Non-existent directory. + [InlineData(@"C:\Some\Bad\Directory")] // Non-existent directory. [InlineData("testhost.dll")] // Existent file. public async Task CanHandleBadInitialWorkingDirectory(string path) { diff --git a/test/PowerShellEditorServices.Test/Session/ScriptFileTests.cs b/test/PowerShellEditorServices.Test/Session/ScriptFileTests.cs index 4839eacfa..11c27c4cf 100644 --- a/test/PowerShellEditorServices.Test/Session/ScriptFileTests.cs +++ b/test/PowerShellEditorServices.Test/Session/ScriptFileTests.cs @@ -654,7 +654,7 @@ public void DocumentUriReturnsCorrectStringForAbsolutePath() scriptFile = new ScriptFile(DocumentUri.FromFileSystemPath(path), emptyStringReader, PowerShellVersion); Assert.Equal("file:///home/NaomiNagata/projects/Rocinate/Proto%3AMole%3Acule.ps1", scriptFile.DocumentUri); - path = "/home/JamesHolden/projects/Rocinate/Proto:Mole\\cule.ps1"; + path = @"/home/JamesHolden/projects/Rocinate/Proto:Mole\cule.ps1"; scriptFile = new ScriptFile(DocumentUri.FromFileSystemPath(path), emptyStringReader, PowerShellVersion); Assert.Equal("file:///home/JamesHolden/projects/Rocinate/Proto%3AMole%5Ccule.ps1", scriptFile.DocumentUri); } @@ -662,12 +662,13 @@ public void DocumentUriReturnsCorrectStringForAbsolutePath() [Trait("Category", "ScriptFile")] [Theory] - [InlineData("C:\\Users\\me\\Documents\\test.ps1", false)] + [InlineData(@"C:\Users\me\Documents\test.ps1", false)] [InlineData("/Users/me/Documents/test.ps1", false)] [InlineData("vscode-notebook-cell:/Users/me/Documents/test.ps1#0001", true)] [InlineData("https://microsoft.com", true)] [InlineData("Untitled:Untitled-1", true)] - [InlineData("'a log statement' > 'c:\\Users\\me\\Documents\\test.txt'\r\n", false)] + [InlineData(@"'a log statement' > 'c:\Users\me\Documents\test.txt' +", false)] public void IsUntitledFileIsCorrect(string path, bool expected) => Assert.Equal(expected, ScriptFile.IsUntitledPath(path)); } }