diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 index 7ad1ba171..f8d2645e0 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 @@ -276,14 +276,15 @@ B1,B2 , '@ | ConvertFrom-Csv -Header P1, P2 - $result.Count | Should -Be 3 # Changed from 4 to 3 + $result.Count | Should -Be 4 $result[0].P1 | Should -Be '' $result[0].P2 | Should -Be '' $result[1].P1 | Should -Be 'A1' $result[1].P2 | Should -Be 'A2' $result[2].P1 | Should -Be 'B1' $result[2].P2 | Should -Be 'B2' - # Removed the fourth assertion since trailing empty line isn't processed + $result[3].P1 | Should -Be '' + $result[3].P2 | Should -BeNullOrEmpty } It 'Should handle whitespace-only fields' { diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1 index 5570a34bc..364077f19 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1 @@ -377,13 +377,15 @@ B1,B2 '@ | Set-Content -Path $csvFile -NoNewline $result = Import-Csv -Path $csvFile -Header P1, P2 - $result.Count | Should -Be 3 + $result.Count | Should -Be 4 $result[0].P1 | Should -Be '' $result[0].P2 | Should -Be '' $result[1].P1 | Should -Be 'A1' $result[1].P2 | Should -Be 'A2' $result[2].P1 | Should -Be 'B1' $result[2].P2 | Should -Be 'B2' + $result[3].P1 | Should -Be '' + $result[3].P2 | Should -BeNullOrEmpty } }