diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 index 4402d8bed..92f4c3ff2 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 @@ -297,7 +297,16 @@ class MyLeaf2 $expectedResult = $expectedResult -replace "[{} `n\r]","" $result | Should -Be $expectedResult } -} + + It "Format-Custom should not lost data" { + # See https://github.com/PowerShell/PowerShell/pull/11342 for more information + $data = (Get-Help Out-Null).Examples + $formattedData = $data | Format-Custom | Out-String + $formattedData | Should -BeLike "*$($data.Example.title)*" + $formattedData | Should -BeLike "*$($data.Example.code)*" + $formattedData | Should -BeLike "*$($data.Example.remarks.Text)*" + } + } Describe "Format-Custom with expression based EntrySelectedBy in a CustomControl" -Tags "CI" { BeforeAll {