Add XUnit test for HandleDoubleAndSingleQuote in CompletionHelpers class (#25181)

This commit is contained in:
Armaan Mcleod
2025-03-17 09:53:01 +00:00
committed by GitHub
parent cb3a241965
commit e8bf560787
@@ -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);
}
}
}