@@ -167,6 +167,9 @@ Describe 'Released yaml-test-suite corpus accounting' {
167167 $firstOrder.Add (' b' , 2 )
168168 $secondOrder.Add (' b' , 2 )
169169 $secondOrder.Add (' a' , 1 )
170+ $ordinarySameOrder = [System.Collections.Specialized.OrderedDictionary ]::new()
171+ $ordinarySameOrder.Add (' a' , 1 )
172+ $ordinarySameOrder.Add (' b' , 2 )
170173 (ConvertTo-YamlSuiteCanonicalValue - Value $firstOrder ) |
171174 Should - Be (ConvertTo-YamlSuiteCanonicalValue - Value $secondOrder )
172175
@@ -181,6 +184,12 @@ Describe 'Released yaml-test-suite corpus accounting' {
181184 ConvertTo-YamlSuiteCanonicalValue - Value $secondOrder `
182185 - OrderedMappings $orderedMappings
183186 )
187+ (ConvertTo-YamlSuiteCanonicalValue - Value $firstOrder `
188+ - OrderedMappings $orderedMappings ) |
189+ Should -Not - Be (
190+ ConvertTo-YamlSuiteCanonicalValue - Value $ordinarySameOrder `
191+ - OrderedMappings $orderedMappings
192+ )
184193
185194 $firstNestedKey = [System.Collections.Specialized.OrderedDictionary ]::new()
186195 $secondNestedKey = [System.Collections.Specialized.OrderedDictionary ]::new()
@@ -272,6 +281,30 @@ ship-to:
272281 $ordinaryResult.OutYamlResult | Should - Be ' Pass'
273282 }
274283
284+ It ' detects explicit ordered-map tag loss across representation surfaces' {
285+ $tagLossSuitePath = Join-Path $TestDrive ' ordered-map-tag-loss'
286+ $tagLossCasePath = Join-Path $tagLossSuitePath ' omap-tag-loss'
287+ $null = New-Item - Path $tagLossCasePath - ItemType Directory - Force
288+ " !!omap`n - a: 1`n - b: 2" |
289+ Set-Content - LiteralPath (Join-Path $tagLossCasePath ' in.yaml' ) `
290+ - Encoding utf8NoBOM
291+ foreach ($fixture in @ (' out.yaml' , ' emit.yaml' )) {
292+ " a: 1`n b: 2" |
293+ Set-Content - LiteralPath (Join-Path $tagLossCasePath $fixture ) `
294+ - Encoding utf8NoBOM
295+ }
296+
297+ $tagLossResult = & $runnerPath - Path $tagLossSuitePath `
298+ - CompareOutYaml - CompareEmitYaml - CompareSelfRoundTrip
299+
300+ $tagLossResult.OutYamlResult | Should - Be ' Fail'
301+ $tagLossResult.OutYamlReason | Should - Be ' OutYamlConstructionMismatch'
302+ $tagLossResult.EmitYamlResult | Should - Be ' Fail'
303+ $tagLossResult.EmitYamlReason | Should - Be ' EmitYamlRepresentationMismatch'
304+ $tagLossResult.SelfRoundTripResult | Should - Be ' PolicyDifference'
305+ $tagLossResult.SelfRoundTripReason | Should - Be ' LegacyOrderedMapProjection'
306+ }
307+
275308 It ' accounts for out.yaml representation comparisons' {
276309 @ ($suiteResults | Where-Object OutYamlResult -EQ ' Pass' ).Count | Should - Be 241
277310 @ ($suiteResults | Where-Object OutYamlResult -EQ ' PolicyDifference' ).Count |
0 commit comments