mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add XUnit test for HandleDoubleAndSingleQuote in CompletionHelpers class (#25181)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Management.Automation;
|
||||
using Xunit;
|
||||
|
||||
namespace PSTests.Parallel
|
||||
{
|
||||
public class CompletionHelpersTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("", "", "")]
|
||||
[InlineData("\"", "", "\"")]
|
||||
[InlineData("'", "", "'")]
|
||||
[InlineData("\"word\"", "word", "\"")]
|
||||
[InlineData("'word'", "word", "'")]
|
||||
[InlineData("\"word", "word", "\"")]
|
||||
[InlineData("'word", "word", "'")]
|
||||
[InlineData("word\"", "word\"", "")]
|
||||
[InlineData("word'", "word'", "")]
|
||||
[InlineData("\"word's\"", "word's", "\"")]
|
||||
[InlineData("'word\"", "'word\"", "")]
|
||||
[InlineData("\"word'", "\"word'", "")]
|
||||
[InlineData("'word\"s'", "word\"s", "'")]
|
||||
public void TestHandleDoubleAndSingleQuote(string wordToComplete, string expectedWordToComplete, string expectedQuote)
|
||||
{
|
||||
string quote = CompletionHelpers.HandleDoubleAndSingleQuote(ref wordToComplete);
|
||||
Assert.Equal(expectedQuote, quote);
|
||||
Assert.Equal(expectedWordToComplete, wordToComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user