Skip to content

Commit ce19801

Browse files
ArmaanMcleodSIRMARGIN
authored andcommitted
Add XUnit test for HandleDoubleAndSingleQuote in CompletionHelpers class (PowerShell#25181)
1 parent 2830409 commit ce19801

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using System.Management.Automation;
5+
using Xunit;
6+
7+
namespace PSTests.Parallel
8+
{
9+
public class CompletionHelpersTests
10+
{
11+
[Theory]
12+
[InlineData("", "", "")]
13+
[InlineData("\"", "", "\"")]
14+
[InlineData("'", "", "'")]
15+
[InlineData("\"word\"", "word", "\"")]
16+
[InlineData("'word'", "word", "'")]
17+
[InlineData("\"word", "word", "\"")]
18+
[InlineData("'word", "word", "'")]
19+
[InlineData("word\"", "word\"", "")]
20+
[InlineData("word'", "word'", "")]
21+
[InlineData("\"word's\"", "word's", "\"")]
22+
[InlineData("'word\"", "'word\"", "")]
23+
[InlineData("\"word'", "\"word'", "")]
24+
[InlineData("'word\"s'", "word\"s", "'")]
25+
public void TestHandleDoubleAndSingleQuote(string wordToComplete, string expectedWordToComplete, string expectedQuote)
26+
{
27+
string quote = CompletionHelpers.HandleDoubleAndSingleQuote(ref wordToComplete);
28+
Assert.Equal(expectedQuote, quote);
29+
Assert.Equal(expectedWordToComplete, wordToComplete);
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)