Add new test for Format-Custom to avoid data loss (#11393)

This commit is contained in:
Ilya 2020-06-30 09:39:48 +05:00 committed by GitHub
parent 1397deffe4
commit 0c8aa53a90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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