From 903393ff371e4d183957b27655930d4d30ab63bc Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Tue, 13 Jan 2026 13:02:05 -0600 Subject: [PATCH] Make tests platform aware --- .../Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 | 5 +++-- .../Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1 | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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 06ba015262..a3050ead5d 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 @@ -316,11 +316,12 @@ Line2","Value2" Line2" '@ | ConvertFrom-Csv + $expectedValue = "Line1$([Environment]::NewLine)Line2" $result.Count | Should -Be 2 - $result[0].P1 | Should -Be "Line1`r`nLine2" + $result[0].P1 | Should -Be $expectedValue $result[0].P2 | Should -Be 'Value2' $result[1].P1 | Should -Be 'Value3' - $result[1].P2 | Should -Be "Line1`r`nLine2" + $result[1].P2 | Should -Be $expectedValue } It 'Should handle escaped quotes within 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 0dfe78e811..27842bb7b1 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1 @@ -423,11 +423,12 @@ Line2" '@ | Set-Content -Path $csvFile -NoNewline $result = Import-Csv -Path $csvFile + $expectedValue = "Line1$([Environment]::NewLine)Line2" $result.Count | Should -Be 2 - $result[0].P1 | Should -Be "Line1`r`nLine2" + $result[0].P1 | Should -Be $expectedValue $result[0].P2 | Should -Be 'Value2' $result[1].P1 | Should -Be 'Value3' - $result[1].P2 | Should -Be "Line1`r`nLine2" + $result[1].P2 | Should -Be $expectedValue } It 'Should handle escaped quotes within fields' {