Add more tests to Tee-Object -Encoding
(#14539)
This commit is contained in:
parent
4eb9e8bea5
commit
cf22188e95
|
@ -30,6 +30,24 @@ Describe "Tee-Object" -Tags "CI" {
|
|||
Get-Content $teefile | Should -BeExactly "teeobjecttest3"
|
||||
}
|
||||
|
||||
$unicodeTestString = "A1£ę௸🤔"
|
||||
It "Should tee output to file using <encoding> encoding when selected" -TestCases @(
|
||||
@{ Encoding = "ascii"; Content = "teeobjecttest1"},
|
||||
@{ Encoding = "bigendianunicode"; Content = $unicodeTestString },
|
||||
@{ Encoding = "default"; Content = $unicodeTestString },
|
||||
@{ Encoding = "latin1"; Content = "téèõbjêcttëst1" },
|
||||
@{ Encoding = "unicode"; Content = $unicodeTestString },
|
||||
@{ Encoding = "utf32"; Content = $unicodeTestString },
|
||||
@{ Encoding = "utf7"; Content = $unicodeTestString},
|
||||
@{ Encoding = "utf8"; Content = $unicodeTestString}
|
||||
) {
|
||||
param($Encoding, $Content)
|
||||
$teefile = $testfile
|
||||
Write-Output -InputObject $content | Tee-Object -FilePath $teefile -Encoding $Encoding
|
||||
Get-Content -Path $teefile -Encoding $Encoding | Should -BeExactly $content
|
||||
Remove-Item -Path $teefile -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
It "Parameter 'Encoding' should accept encoding" {
|
||||
$teefile = $testfile
|
||||
$encoding = 1251
|
||||
|
|
Loading…
Reference in a new issue