mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Do not always collapse space between parameter and value for native arguments. (#17708)
This commit is contained in:
@@ -165,7 +165,17 @@ namespace System.Management.Automation
|
||||
{
|
||||
if (argument != parameter.ParameterText)
|
||||
{
|
||||
_argumentList.Add(parameter.ParameterText + argument);
|
||||
// Only combine the text and argument if there was no space after the parameter,
|
||||
// otherwise, add the parameter and arguments as separate elements.
|
||||
if (parameter.SpaceAfterParameter)
|
||||
{
|
||||
_argumentList.Add(parameter.ParameterText);
|
||||
_argumentList.Add(argument);
|
||||
}
|
||||
else
|
||||
{
|
||||
_argumentList.Add(parameter.ParameterText + argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -239,6 +239,14 @@ foreach ( $argumentListValue in "Standard","Legacy","Windows" ) {
|
||||
$lines[1] | Should -BeExactly "Arg 1 is <com:port=\\devbox\pipe\debug,pipe,resets=0,reconnect>"
|
||||
}
|
||||
|
||||
It "Should handle when the ':' is the parameter value" {
|
||||
$lines = testexe -echoargs awk -F: '{print $1}'
|
||||
$lines.Count | Should -Be 3
|
||||
$lines[0] | Should -BeExactly 'Arg 0 is <awk>'
|
||||
$lines[1] | Should -BeExactly 'Arg 1 is <-F:>'
|
||||
$lines[2] | Should -BeExactly 'Arg 2 is <{print $1}>'
|
||||
}
|
||||
|
||||
It "Should handle DOS style arguments" {
|
||||
$lines = testexe -echoargs /arg1 /c:"a string"
|
||||
$lines.Count | Should -Be 2
|
||||
|
||||
Reference in New Issue
Block a user