|
| 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