Skip to content

Commit

Permalink
Fix regression in PowerShell#20608. (PowerShell#20745)
Browse files Browse the repository at this point in the history
  • Loading branch information
mawosoft authored and VindSkyggen committed Dec 26, 2023
1 parent 0e5836d commit 332052d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ private static string BuildName(List<ObjectCommandPropertyValue> propValues)

foreach (object item in propertyValueItems)
{
sb.AppendFormat(CultureInfo.CurrentCulture, $"{item}, ");
sb.Append(CultureInfo.CurrentCulture, $"{item}, ");
}

sb = sb.Length > length ? sb.Remove(sb.Length - 2, 2) : sb;
sb.Append("}, ");
}
else
{
sb.AppendFormat(CultureInfo.CurrentCulture, $"{propValuePropertyValue}, ");
sb.Append(CultureInfo.CurrentCulture, $"{propValuePropertyValue}, ");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ Describe "Group-Object" -Tags "CI" {
$result[0].Name | Should -Be ""
$result[0].Group | Should -Be '@{X=}'
}

It "Should handle format-like strings with curly braces like normal strings" {
$result = '{', '}', '{0}' | Group-Object
$result.Count | Should -Be 3
$result[0].Name | Should -BeExactly '{'
$result[1].Name | Should -BeExactly '{0}'
$result[2].Name | Should -BeExactly '}'
}
}

Describe "Check 'Culture' parameter in order object cmdlets (Group-Object, Sort-Object, Compare-Object)" -Tags "CI" {
Expand Down

0 comments on commit 332052d

Please sign in to comment.