@@ -249,6 +249,67 @@ Describe 'Released yaml-test-suite corpus accounting' {
249249 $nonSpecificEvents | Should - Contain ' =VAL|nonSpecificTag=true|value=value'
250250 }
251251
252+ It ' distinguishes implicit scalar tags without treating style as semantic' {
253+ foreach ($mutation in @ (
254+ @ { Plain = ' true' ; Quoted = ' "true"' ; Tag = ' tag:yaml.org,2002:bool' }
255+ @ { Plain = ' 42' ; Quoted = ' "42"' ; Tag = ' tag:yaml.org,2002:int' }
256+ @ { Plain = ' 1.5' ; Quoted = ' "1.5"' ; Tag = ' tag:yaml.org,2002:float' }
257+ @ { Plain = ' .inf' ; Quoted = ' ".inf"' ; Tag = ' tag:yaml.org,2002:float' }
258+ @ { Plain = ' null' ; Quoted = ' "null"' ; Tag = ' tag:yaml.org,2002:null' }
259+ )) {
260+ $plain = Invoke-InYamlModule - ScriptBlock $readYamlSuiteRepresentation `
261+ - Arguments @ ($mutation.Plain )
262+ $quoted = Invoke-InYamlModule - ScriptBlock $readYamlSuiteRepresentation `
263+ - Arguments @ ($mutation.Quoted )
264+ $plainEvents = ConvertTo-YamlSuiteActualEvent - Documents $plain.Value `
265+ - IncludeEffectiveScalarTags
266+ $quotedEvents = ConvertTo-YamlSuiteActualEvent - Documents $quoted.Value `
267+ - IncludeEffectiveScalarTags
268+
269+ (Compare-YamlSuiteCanonicalList - Left $plainEvents - Right $quotedEvents ) |
270+ Should - BeFalse
271+ $plainEvents | Should - Contain (
272+ ' =VAL|tag={0}|value={1}' -f $mutation.Tag , $mutation.Plain
273+ )
274+ $quotedEvents | Should - Contain (
275+ ' =VAL|tag=tag:yaml.org,2002:str|value={0}' -f $mutation.Plain
276+ )
277+ }
278+
279+ $singleQuoted = Invoke-InYamlModule - ScriptBlock $readYamlSuiteRepresentation `
280+ - Arguments @ (" 'value'" )
281+ $doubleQuoted = Invoke-InYamlModule - ScriptBlock $readYamlSuiteRepresentation `
282+ - Arguments @ (' "value"' )
283+ $singleEvents = ConvertTo-YamlSuiteActualEvent - Documents $singleQuoted.Value `
284+ - IncludeEffectiveScalarTags
285+ $doubleEvents = ConvertTo-YamlSuiteActualEvent - Documents $doubleQuoted.Value `
286+ - IncludeEffectiveScalarTags
287+
288+ (Compare-YamlSuiteCanonicalList - Left $singleEvents - Right $doubleEvents ) |
289+ Should - BeTrue
290+
291+ $explicit = Invoke-InYamlModule - ScriptBlock $readYamlSuiteRepresentation `
292+ - Arguments @ (' !!str value' )
293+ $unknown = Invoke-InYamlModule - ScriptBlock $readYamlSuiteRepresentation `
294+ - Arguments @ (' !local value' )
295+ $nonSpecific = Invoke-InYamlModule - ScriptBlock $readYamlSuiteRepresentation `
296+ - Arguments @ (' ! value' )
297+ $explicitEvents = ConvertTo-YamlSuiteActualEvent - Documents $explicit.Value `
298+ - IncludeEffectiveScalarTags
299+ $unknownEvents = ConvertTo-YamlSuiteActualEvent - Documents $unknown.Value `
300+ - IncludeEffectiveScalarTags
301+ $nonSpecificEvents = ConvertTo-YamlSuiteActualEvent - Documents $nonSpecific.Value `
302+ - IncludeEffectiveScalarTags
303+
304+ $explicitEvents |
305+ Should - Contain ' =VAL|tag=tag:yaml.org,2002:str|explicitTag=true|value=value'
306+ $unknownEvents | Should - Contain ' =VAL|tag=!local|explicitTag=true|value=value'
307+ $nonSpecificEvents |
308+ Should - Contain ' =VAL|tag=tag:yaml.org,2002:str|nonSpecificTag=true|value=value'
309+ (Compare-YamlSuiteCanonicalList - Left $explicitEvents - Right $doubleEvents ) |
310+ Should - BeFalse
311+ }
312+
252313 It ' detects altered ordered-map and alias semantics in out.yaml' {
253314 $mutatedSuitePath = Join-Path $TestDrive ' mutated-out-cases'
254315 $null = New-Item - Path $mutatedSuitePath - ItemType Directory - Force
0 commit comments