Fix for Get-Content -ReadCount 0 behavior when -TotalCount is set (#10749)

This commit is contained in:
Eugene Samoylov authored and Aditya Patwardhan committed 2019-10-14 17:32:37 -07:00
1 parent 76a811c88d
commit d528bf5d3d
2 files changed
+7 -1

No files matched your search

@@ -342,6 +342,12 @@ baz
$expected[1] = $thirdLine
Compare-Object -ReferenceObject $expected -DifferenceObject $result | Should -BeNullOrEmpty
}
It "Should return the same number of first lines as set in -TotalCount at one time for -ReadCount 0" {
$result = Get-Content -Path $testPath -TotalCount 3 -ReadCount 0
$result.Length | Should -Be 3
$expected = $firstLine,$secondLine,$thirdLine
Compare-Object -ReferenceObject $expected -DifferenceObject $result | Should -BeNullOrEmpty
}
It "A warning should be emitted if both -AsByteStream and -Encoding are used together" {
[byte[]][char[]]"test" | Set-Content -Encoding Unicode -AsByteStream "${TESTDRIVE}\bfile.txt" -WarningVariable contentWarning *> $null
$contentWarning.Message | Should -Match "-AsByteStream"