@@ -85,27 +85,74 @@ Describe 'Import-Yaml' {
8585 @ ($result.value ) | Should - Be @ (' first' , ' second' )
8686 }
8787
88- It ' keeps case-distinct files separate on case-sensitive filesystems' - Skip: $IsWindows {
88+ It ' keeps case-distinct files separate on case-sensitive filesystems' {
8989 $upperPath = Join-Path $TestDrive ' Case.yaml'
9090 $lowerPath = Join-Path $TestDrive ' case.yaml'
9191 [System.IO.File ]::WriteAllText($upperPath , ' value: upper' )
9292 [System.IO.File ]::WriteAllText($lowerPath , ' value: lower' )
93+ if ([System.IO.File ]::ReadAllText($upperPath ) -eq
94+ [System.IO.File ]::ReadAllText($lowerPath )) {
95+ Set-ItResult - Skipped - Because ' the test filesystem is case-insensitive'
96+ return
97+ }
9398
9499 $result = @ (Import-Yaml - Path @ ($upperPath , $lowerPath ))
95100
96101 @ ($result.value ) | Should - Be @ (' upper' , ' lower' )
97102 }
98103
99- It ' suppresses path case variants on case-insensitive filesystems' - Skip:( -not $IsWindows ) {
104+ It ' suppresses path case variants on case-insensitive filesystems' {
100105 $path = Join-Path $TestDrive ' CaseVariant.yaml'
101106 [System.IO.File ]::WriteAllText($path , ' value: once' )
107+ $caseVariantPath = $path.ToLowerInvariant ()
108+ try {
109+ $null = [System.IO.File ]::GetAttributes($caseVariantPath )
110+ } catch [System.IO.FileNotFoundException ] {
111+ Set-ItResult - Skipped - Because ' the test filesystem is case-sensitive'
112+ return
113+ }
114+
115+ $result = @ (Import-Yaml - Path @ ($path , $caseVariantPath ))
116+
117+ $result.Count | Should - Be 1
118+ $result [0 ].value | Should - Be ' once'
119+ }
120+
121+ It ' suppresses Unicode normalization aliases on matching filesystems' {
122+ $composedPath = Join-Path $TestDrive " caf$ ( [char ] 0x00E9 ) .yaml"
123+ $decomposedPath = Join-Path $TestDrive " cafe$ ( [char ] 0x0301 ) .yaml"
124+ [System.IO.File ]::WriteAllText($composedPath , ' value: once' )
125+ try {
126+ $null = [System.IO.File ]::GetAttributes($decomposedPath )
127+ } catch [System.IO.FileNotFoundException ] {
128+ Set-ItResult - Skipped - Because (
129+ ' the test filesystem distinguishes Unicode normalization forms'
130+ )
131+ return
132+ }
102133
103- $result = @ (Import-Yaml - Path @ ($path , $path .ToLowerInvariant () ))
134+ $result = @ (Import-Yaml - LiteralPath @ ($composedPath , $decomposedPath ))
104135
105136 $result.Count | Should - Be 1
106137 $result [0 ].value | Should - Be ' once'
107138 }
108139
140+ It ' keeps delimiter-bearing Unix paths distinct' - Skip:$IsWindows {
141+ $separator = [char ] 0x001F
142+ $firstDirectory = Join-Path $TestDrive ' identity-a'
143+ $secondDirectory = Join-Path $TestDrive " identity-a${separator} identity-b"
144+ $null = [System.IO.Directory ]::CreateDirectory($firstDirectory )
145+ $null = [System.IO.Directory ]::CreateDirectory($secondDirectory )
146+ $firstPath = Join-Path $firstDirectory " identity-b${separator} value.yaml"
147+ $secondPath = Join-Path $secondDirectory ' value.yaml'
148+ [System.IO.File ]::WriteAllText($firstPath , ' value: first' )
149+ [System.IO.File ]::WriteAllText($secondPath , ' value: second' )
150+
151+ $result = @ (Import-Yaml - LiteralPath @ ($firstPath , $secondPath ))
152+
153+ @ ($result.value | Sort-Object ) | Should - Be @ (' first' , ' second' )
154+ }
155+
109156 It ' sorts by canonical identity regardless of duplicate path spelling' {
110157 $firstPath = Join-Path $TestDrive ' canonical-a.yaml'
111158 $secondPath = Join-Path $TestDrive ' canonical-b.yaml'
0 commit comments