@@ -243,26 +243,19 @@ function ConvertTo-YamlSuiteReferenceSignature {
243243 return ($output -join ' ;' )
244244}
245245
246- function Get-YamlSuitePolicyReason {
246+ function Get-YamlSuiteJsonPolicyReason {
247247 [CmdletBinding ()]
248248 [OutputType ([string ])]
249249 param (
250- [string ] $YamlText ,
251- [string ] $Expected ,
252- [string ] $Actual ,
253- [string ] $DefaultReason
250+ [Parameter (Mandatory )]
251+ [string ] $Case
254252 )
255253
256- if ($DefaultReason ) {
257- return $DefaultReason
258- }
259- if ($YamlText -cmatch ' !!(?:binary|omap|pairs|set|timestamp)(?:[ \t\r\n,\[\]\{\}]|$)' ) {
260- return ' StandardTagProjectionPolicy'
261- }
262- if (($Expected -match ' unsupported:' -or $Actual -match ' unsupported:' )) {
263- return ' PowerShellTypePolicy'
254+ switch - CaseSensitive ($Case ) {
255+ ' 565N' { return ' BinaryByteArrayProjection' }
256+ ' J7PZ' { return ' LegacyOrderedMapProjection' }
257+ default { return ' ' }
264258 }
265- return ' '
266259}
267260
268261function ConvertFrom-YamlSuiteEventText {
@@ -694,9 +687,10 @@ foreach ($inputFile in $inputFiles) {
694687 }
695688 if ($expectsError ) {
696689 $syntaxResult = ' Pass'
697- } elseif ($_.Exception.Data [' YamlErrorId' ] -eq ' YamlDuplicateKey' ) {
690+ } elseif ($casePath -cin @ (' 2JQS' , ' X38W' ) -and
691+ $_.Exception.Data [' YamlErrorId' ] -eq ' YamlDuplicateKey' ) {
698692 $syntaxResult = ' PolicyDifference'
699- $syntaxReason = ' DuplicateKeyRejected '
693+ $syntaxReason = ' RepresentationMappingKeyUniqueness '
700694 } else {
701695 $syntaxResult = ' Fail'
702696 $syntaxReason = [string ] $_.Exception.Data [' YamlErrorId' ]
@@ -732,15 +726,8 @@ foreach ($inputFile in $inputFiles) {
732726 if (Compare-YamlSuiteCanonicalList - Left $actualEvents - Right $expectedEvents ) {
733727 $eventResult = ' Pass'
734728 } else {
735- $reason = Get-YamlSuitePolicyReason - YamlText $yaml - Expected ($expectedEvents -join " `n " ) `
736- - Actual ($actualEvents -join " `n " ) - DefaultReason ' '
737- if ($reason ) {
738- $eventResult = ' PolicyDifference'
739- $eventReason = $reason
740- } else {
741- $eventResult = ' Fail'
742- $eventReason = ' EventMismatch'
743- }
729+ $eventResult = ' Fail'
730+ $eventReason = ' EventMismatch'
744731 }
745732 }
746733 }
@@ -765,8 +752,7 @@ foreach ($inputFile in $inputFiles) {
765752 if ($projectedCanonical -ceq $expectedCanonical ) {
766753 $jsonResult = ' Pass'
767754 } else {
768- $reason = Get-YamlSuitePolicyReason - YamlText $yaml - Expected $expectedCanonical `
769- - Actual $projectedCanonical - DefaultReason ' '
755+ $reason = Get-YamlSuiteJsonPolicyReason - Case $casePath
770756 if ($reason ) {
771757 $jsonResult = ' PolicyDifference'
772758 $jsonReason = $reason
@@ -794,15 +780,8 @@ foreach ($inputFile in $inputFiles) {
794780 if ($outCanonical -ceq $projectedCanonical ) {
795781 $outYamlResult = ' Pass'
796782 } else {
797- $reason = Get-YamlSuitePolicyReason - YamlText $yaml - Expected $projectedCanonical `
798- - Actual $outCanonical - DefaultReason ' '
799- if ($reason ) {
800- $outYamlResult = ' PolicyDifference'
801- $outYamlReason = $reason
802- } else {
803- $outYamlResult = ' Fail'
804- $outYamlReason = ' OutYamlConstructionMismatch'
805- }
783+ $outYamlResult = ' Fail'
784+ $outYamlReason = ' OutYamlConstructionMismatch'
806785 }
807786 } catch {
808787 if ($_.Exception.Data.Contains (' IsYamlException' )) {
@@ -820,7 +799,7 @@ foreach ($inputFile in $inputFiles) {
820799 $emitResult = ' NotApplicable'
821800 if ($expectsError ) { $emitReason = ' InvalidSyntax' }
822801 } elseif ($projectionError ) {
823- $emitResult = ' PolicyDifference '
802+ $emitResult = ' Fail '
824803 $emitReason = $projectionError
825804 } elseif ($syntaxResult -eq ' PolicyDifference' ) {
826805 $emitResult = ' PolicyDifference'
@@ -855,19 +834,12 @@ foreach ($inputFile in $inputFiles) {
855834 if ($roundCanonical -ceq $projectedCanonical -and $roundReference -ceq $projectedReference ) {
856835 $emitResult = ' Pass'
857836 } else {
858- $reason = Get-YamlSuitePolicyReason - YamlText $yaml - Expected $projectedCanonical `
859- - Actual $roundCanonical - DefaultReason ' '
860- if ($reason ) {
861- $emitResult = ' PolicyDifference'
862- $emitReason = $reason
863- } else {
864- $emitResult = ' Fail'
865- $emitReason = ' EmitRoundTripMismatch'
866- }
837+ $emitResult = ' Fail'
838+ $emitReason = ' EmitRoundTripMismatch'
867839 }
868840 }
869841 } catch [System.NotSupportedException ] {
870- $emitResult = ' PolicyDifference '
842+ $emitResult = ' Fail '
871843 $emitReason = ' UnsupportedEmissionType'
872844 } catch {
873845 if ($_.Exception.Data.Contains (' IsYamlException' )) {
0 commit comments