mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Fix for Get-Content -ReadCount 0 behavior when -TotalCount is set (#10749)
This commit is contained in:
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"
|
||||
|
||||
Reference in new issue
Block a user