From 8bf5e632e9b1c8ac0e051f9c1affb1393a91096a Mon Sep 17 00:00:00 2001 From: Ilya Date: Wed, 18 Dec 2019 13:03:52 +0500 Subject: [PATCH] Add new test for Format-Custom to avoid data loss --- .../Format-Custom.Tests.ps1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 4402d8bed74..92f4c3ff213 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 {