@@ -104,12 +104,17 @@ Describe 'Import-Yaml' {
104104 It ' suppresses path case variants on case-insensitive filesystems' {
105105 $path = Join-Path $TestDrive ' CaseVariant.yaml'
106106 [System.IO.File ]::WriteAllText($path , ' value: once' )
107- $caseVariantPath = $path.ToLowerInvariant ()
107+ $caseVariantPath = Join-Path (
108+ Split-Path - Parent $path
109+ ) ([System.IO.Path ]::GetFileName($path ).ToLowerInvariant())
108110 try {
109111 $null = [System.IO.File ]::GetAttributes($caseVariantPath )
110112 } catch [System.IO.FileNotFoundException ] {
111113 Set-ItResult - Skipped - Because ' the test filesystem is case-sensitive'
112114 return
115+ } catch [System.IO.DirectoryNotFoundException ] {
116+ Set-ItResult - Skipped - Because ' the test filesystem is case-sensitive'
117+ return
113118 }
114119
115120 $result = @ (Import-Yaml - Path @ ($path , $caseVariantPath ))
@@ -156,14 +161,19 @@ Describe 'Import-Yaml' {
156161 It ' sorts by canonical identity regardless of duplicate path spelling' {
157162 $firstPath = Join-Path $TestDrive ' canonical-a.yaml'
158163 $secondPath = Join-Path $TestDrive ' canonical-b.yaml'
159- $secondAlias = $secondPath.ToUpperInvariant ()
164+ $secondAlias = Join-Path (
165+ Split-Path - Parent $secondPath
166+ ) ([System.IO.Path ]::GetFileName($secondPath ).ToUpperInvariant())
160167 [System.IO.File ]::WriteAllText($firstPath , ' value: first' )
161168 [System.IO.File ]::WriteAllText($secondPath , ' value: second' )
162169 try {
163170 $null = [System.IO.File ]::GetAttributes($secondAlias )
164171 } catch [System.IO.FileNotFoundException ] {
165172 Set-ItResult - Skipped - Because ' the test filesystem is case-sensitive'
166173 return
174+ } catch [System.IO.DirectoryNotFoundException ] {
175+ Set-ItResult - Skipped - Because ' the test filesystem is case-sensitive'
176+ return
167177 }
168178
169179 $result = @ (Import-Yaml - Path @ ($secondAlias , $firstPath , $secondPath ))
0 commit comments