diff --git a/package.json b/package.json index 915882ad9..9f6ef28f5 100644 --- a/package.json +++ b/package.json @@ -172,7 +172,8 @@ "serialize-javascript": "7.0.0", "tempy": "3.1.0", "tinybench": "5.1.0", - "ts-expect": "1.3.0" + "ts-expect": "1.3.0", + "yaml-test-suite": "0.0.2" }, "resolutions": { "trim": "1.0.1" diff --git a/tests/format/yaml/yaml-test-suite/__snapshots__/format.test.js.snap b/tests/format/yaml/yaml-test-suite/__snapshots__/format.test.js.snap new file mode 100644 index 000000000..851b954c1 --- /dev/null +++ b/tests/format/yaml/yaml-test-suite/__snapshots__/format.test.js.snap @@ -0,0 +1,6268 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`snippet: 2AUY.yaml - Tags in Block Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + - !!str a + - b + - !!int 42 + - d + +=====================================output===================================== +- !!str a +- b +- !!int 42 +- d + +================================================================================ +`; + +exports[`snippet: 2EBW.yaml - Allowed characters in keys format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_\`az{|}~: safe +?foo: safe question mark +:foo: safe colon +-foo: safe dash +this is#not: a comment + +=====================================output===================================== +a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_\`az{|}~: safe +?foo: safe question mark +:foo: safe colon +-foo: safe dash +this is#not: a comment + +================================================================================ +`; + +exports[`snippet: 2G84-3.yaml - Literal modifers(3) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- |1- +=====================================output===================================== +--- +|1- + +================================================================================ +`; + +exports[`snippet: 2G84-4.yaml - Literal modifers(4) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- |1+ +=====================================output===================================== +--- +|1+ +================================================================================ +`; + +exports[`snippet: 2LFX.yaml - Spec Example 6.13. Reserved Directives [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%FOO bar baz # Should be ignored + # with a warning. +--- +"foo" + +=====================================output===================================== +%FOO bar baz # Should be ignored +# with a warning. +--- +"foo" + +================================================================================ +`; + +exports[`snippet: 2SXE.yaml - Anchors With Colon in Name format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +&a: key: &a value +foo: + *a: + +=====================================output===================================== +&a: key: &a value +foo: *a: + +================================================================================ +`; + +exports[`snippet: 2XXW.yaml - Spec Example 2.25. Unordered Sets format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# Sets are represented as a +# Mapping where each key is +# associated with a null value +--- !!set +? Mark McGwire +? Sammy Sosa +? Ken Griff + +=====================================output===================================== +# Sets are represented as a +# Mapping where each key is +# associated with a null value +--- +!!set +? Mark McGwire +? Sammy Sosa +? Ken Griff + +================================================================================ +`; + +exports[`snippet: 3ALJ.yaml - Block Sequence in Block Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- - s1_i1 + - s1_i2 +- s2 + +=====================================output===================================== +- - s1_i1 + - s1_i2 +- s2 + +================================================================================ +`; + +exports[`snippet: 3GZX.yaml - Spec Example 7.1. Alias Nodes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +First occurrence: &anchor Foo +Second occurrence: *anchor +Override anchor: &anchor Bar +Reuse anchor: *anchor + +=====================================output===================================== +First occurrence: &anchor Foo +Second occurrence: *anchor +Override anchor: &anchor Bar +Reuse anchor: *anchor + +================================================================================ +`; + +exports[`snippet: 3MYT.yaml - Plain Scalar looking like key, comment, anchor and tag format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +k:#foo + &a !t s + +=====================================output===================================== +--- +k:#foo +&a !t s + +================================================================================ +`; + +exports[`snippet: 3R3P.yaml - Single block sequence with anchor format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +&sequence +- a + +=====================================output===================================== +&sequence +- a + +================================================================================ +`; + +exports[`snippet: 3RLN.yaml - Leading tabs in double quoted format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"1 leading + \\ttab" + +=====================================output===================================== +"1 leading +\\ttab" + +================================================================================ +`; + +exports[`snippet: 3RLN-2.yaml - Leading tabs in double quoted(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"2 leading + \\ tab" + +=====================================output===================================== +"2 leading +\\ tab" + +================================================================================ +`; + +exports[`snippet: 3RLN-3.yaml - Leading tabs in double quoted(3) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"3 leading + tab" + +=====================================output===================================== +"3 leading +tab" + +================================================================================ +`; + +exports[`snippet: 3RLN-4.yaml - Leading tabs in double quoted(4) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"4 leading + \\t tab" + +=====================================output===================================== +"4 leading +\\t tab" + +================================================================================ +`; + +exports[`snippet: 3RLN-5.yaml - Leading tabs in double quoted(5) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"5 leading + \\ tab" + +=====================================output===================================== +"5 leading +\\ tab" + +================================================================================ +`; + +exports[`snippet: 3RLN-6.yaml - Leading tabs in double quoted(6) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"6 leading + tab" + +=====================================output===================================== +"6 leading +tab" + +================================================================================ +`; + +exports[`snippet: 3UYS.yaml - Escaped slash in double quotes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +escaped slash: "a\\/b" + +=====================================output===================================== +escaped slash: "a\\/b" + +================================================================================ +`; + +exports[`snippet: 4ABK.yaml - Flow Mapping Separate Values format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ +unquoted : "separate", +http://foo.com, +omitted value:, +} + +=====================================output===================================== +{ unquoted: "separate", http://foo.com, omitted value } + +================================================================================ +`; + +exports[`snippet: 4CQQ.yaml - Spec Example 2.18. Multi-line Flow Scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +plain: + This unquoted scalar + spans many lines. + +quoted: "So does this + quoted scalar.\\n" + +=====================================output===================================== +plain: This unquoted scalar + spans many lines. + +quoted: "So does this + quoted scalar.\\n" + +================================================================================ +`; + +exports[`snippet: 4FJ6.yaml - Nested implicit complex keys format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +[ + [ a, [ [[b,c]]: d, e]]: 23 +] + +=====================================output===================================== +--- +[[a, [[[b, c]]: d, e]]: 23] + +================================================================================ +`; + +exports[`snippet: 4GC6.yaml - Spec Example 7.7. Single Quoted Characters format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +'here''s to "quotes"' + +=====================================output===================================== +'here''s to "quotes"' + +================================================================================ +`; + +exports[`snippet: 4MUZ.yaml - Flow mapping colon on line after key format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{"foo" +: "bar"} + +=====================================output===================================== +{ "foo": "bar" } + +================================================================================ +`; + +exports[`snippet: 4MUZ-2.yaml - Flow mapping colon on line after key(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{"foo" +: bar} + +=====================================output===================================== +{ "foo": bar } + +================================================================================ +`; + +exports[`snippet: 4MUZ-3.yaml - Flow mapping colon on line after key(3) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{foo +: bar} + +=====================================output===================================== +{ foo: bar } + +================================================================================ +`; + +exports[`snippet: 4Q9F.yaml - Folded Block Scalar [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- > + ab + cd + + ef + + + gh + +=====================================output===================================== +--- +> + ab + cd + + ef + + + gh + +================================================================================ +`; + +exports[`snippet: 4QFQ.yaml - Spec Example 8.2. Block Indentation Indicator [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- | + detected +- > + + + # detected +- |1 + explicit +- > + detected + +=====================================output===================================== +- | + detected +- > + + + # detected +- |1 + explicit +- > + detected + +================================================================================ +`; + +exports[`snippet: 4RWC.yaml - Trailing spaces after flow collection format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + [1, 2, 3] + +=====================================output===================================== +[1, 2, 3] + +================================================================================ +`; + +exports[`snippet: 4UYU.yaml - Colon in Double Quoted String format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"foo: bar\\": baz" + +=====================================output===================================== +'foo: bar": baz' + +================================================================================ +`; + +exports[`snippet: 4V8U.yaml - Plain scalar with backslashes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +plain\\value\\with\\backslashes + +=====================================output===================================== +--- +plain\\value\\with\\backslashes + +================================================================================ +`; + +exports[`snippet: 4WA9.yaml - Literal scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- aaa: |2 + xxx + bbb: | + xxx + +=====================================output===================================== +- aaa: |2 + xxx + bbb: | + xxx + +================================================================================ +`; + +exports[`snippet: 4ZYM.yaml - Spec Example 6.4. Line Prefixes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +plain: text + lines +quoted: "text + lines" +block: | + text + lines + +=====================================output===================================== +plain: text + lines +quoted: "text + lines" +block: | + text + lines + +================================================================================ +`; + +exports[`snippet: 5BVJ.yaml - Spec Example 5.7. Block Scalar Indicators format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +literal: | + some + text +folded: > + some + text + +=====================================output===================================== +literal: | + some + text +folded: > + some + text + +================================================================================ +`; + +exports[`snippet: 5C5M.yaml - Spec Example 7.15. Flow Mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- { one : two , three: four , } +- {five: six,seven : eight} + +=====================================output===================================== +- { one: two, three: four } +- { five: six, seven: eight } + +================================================================================ +`; + +exports[`snippet: 5GBF.yaml - Spec Example 6.5. Empty Lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +Folding: + "Empty line + + as a line feed" +Chomping: | + Clipped empty lines + + + +=====================================output===================================== +Folding: "Empty line + + as a line feed" +Chomping: | + Clipped empty lines + +================================================================================ +`; + +exports[`snippet: 5KJE.yaml - Spec Example 7.13. Flow Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- [ one, two, ] +- [three ,four] + +=====================================output===================================== +- [one, two] +- [three, four] + +================================================================================ +`; + +exports[`snippet: 5MUD.yaml - Colon and adjacent value on next line format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +{ "foo" + :bar } + +=====================================output===================================== +--- +{ "foo": bar } + +================================================================================ +`; + +exports[`snippet: 5NYZ.yaml - Spec Example 6.9. Separated Comment format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +key: # Comment + value + +=====================================output===================================== +key: # Comment + value + +================================================================================ +`; + +exports[`snippet: 5T43.yaml - Colon at the beginning of adjacent flow scalar format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- { "key":value } +- { "key"::value } + +=====================================output===================================== +- { "key": value } +- { "key": :value } + +================================================================================ +`; + +exports[`snippet: 5TYM.yaml - Spec Example 6.21. Local Tag Prefix format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%TAG !m! !my- +--- # Bulb here +!m!light fluorescent +... +%TAG !m! !my- +--- # Color here +!m!light green + +=====================================output===================================== +%TAG !m! !my- +--- # Bulb here +!m!light fluorescent +... +%TAG !m! !my- +--- # Color here +!m!light green + +================================================================================ +`; + +exports[`snippet: 5WE3.yaml - Spec Example 8.17. Explicit Block Mapping Entries format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? explicit key # Empty value +? | + block key +: - one # Explicit compact + - two # block value + +=====================================output===================================== +? explicit key # Empty value +? | + block key +: - one # Explicit compact + - two # block value + +================================================================================ +`; + +exports[`snippet: 6BCT.yaml - Spec Example 6.3. Separation Spaces format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- foo: bar +- - baz + - baz + +=====================================output===================================== +- foo: bar +- - baz + - baz + +================================================================================ +`; + +exports[`snippet: 6BFJ.yaml - Mapping, key and flow sequence item anchors format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +&mapping +&key [ &item a, b, c ]: value + +=====================================output===================================== +--- +&mapping +&key [&item a, b, c]: value + +================================================================================ +`; + +exports[`snippet: 6CA3.yaml - Tab indented top flow format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + [ + ] + +=====================================output===================================== +[] + +================================================================================ +`; + +exports[`snippet: 6CK3.yaml - Spec Example 6.26. Tag Shorthands format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%TAG !e! tag:example.com,2000:app/ +--- +- !local foo +- !!str bar +- !e!tag%21 baz + +=====================================output===================================== +%TAG !e! tag:example.com,2000:app/ +--- +- !local foo +- !!str bar +- !e!tag%21 baz + +================================================================================ +`; + +exports[`snippet: 6FWR.yaml - Block Scalar Keep format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- |+ + ab + + +... + +=====================================output===================================== +--- +|+ + ab + + +... +================================================================================ +`; + +exports[`snippet: 6H3V.yaml - Backslashes in singlequotes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +'foo: bar\\': baz' + +=====================================output===================================== +'foo: bar\\': baz' + +================================================================================ +`; + +exports[`snippet: 6HB6.yaml - Spec Example 6.1. Indentation Spaces format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + # Leading comment line spaces are + # neither content nor indentation. + +Not indented: + By one space: | + By four + spaces + Flow style: [ # Leading spaces + By two, # in flow style + Also by two, # are neither + Still by two # content nor + ] # indentation. + +=====================================output===================================== +# Leading comment line spaces are +# neither content nor indentation. + +Not indented: + By one space: | + By four + spaces + Flow style: # Leading spaces + [ + By two, # in flow style + Also by two, # are neither + Still by two, # content nor + ] # indentation. + +================================================================================ +`; + +exports[`snippet: 6JQW.yaml - Spec Example 2.13. In literals, newlines are preserved format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# ASCII Art +--- | + \\//||\\/|| + // || ||__ + +=====================================output===================================== +# ASCII Art +--- +| + \\//||\\/|| + // || ||__ + +================================================================================ +`; + +exports[`snippet: 6JWB.yaml - Tags for Block Objects format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: !!seq + - !!str a + - !!map + key: !!str value + +=====================================output===================================== +foo: !!seq + - !!str a + - !!map + key: !!str value + +================================================================================ +`; + +exports[`snippet: 6KGN.yaml - Anchor for empty node format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +a: &anchor +b: *anchor + +=====================================output===================================== +--- +a: &anchor +b: *anchor + +================================================================================ +`; + +exports[`snippet: 6LVF.yaml - Spec Example 6.13. Reserved Directives format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%FOO bar baz # Should be ignored + # with a warning. +--- "foo" + +=====================================output===================================== +%FOO bar baz # Should be ignored +# with a warning. +--- +"foo" + +================================================================================ +`; + +exports[`snippet: 6M2F.yaml - Aliases in Explicit Block Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? &a a +: &b b +: *a + +=====================================output===================================== +&a a: &b b +: *a + +================================================================================ +`; + +exports[`snippet: 6PBE.yaml - Zero-indented sequences in explicit mapping keys format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +? +- a +- b +: +- c +- d + +=====================================output===================================== +--- +? - a + - b +: - c + - d + +================================================================================ +`; + +exports[`snippet: 6SLA.yaml - Allowed characters in quoted mapping key format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"foo\\nbar:baz\\tx \\\\$%^&*()x": 23 +'x\\ny:z\\tx $%^&*()x': 24 + +=====================================output===================================== +"foo\\nbar:baz\\tx \\\\$%^&*()x": 23 +'x\\ny:z\\tx $%^&*()x': 24 + +================================================================================ +`; + +exports[`snippet: 6VJK.yaml - Spec Example 2.15. Folded newlines are preserved for "more indented" and blank lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +> + Sammy Sosa completed another + fine season with great stats. + + 63 Home Runs + 0.288 Batting Average + + What a year! + +=====================================output===================================== +> + Sammy Sosa completed another + fine season with great stats. + + 63 Home Runs + 0.288 Batting Average + + What a year! + +================================================================================ +`; + +exports[`snippet: 6WLZ.yaml - Spec Example 6.18. Primary Tag Handle [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# Private +--- +!foo "bar" +... +# Global +%TAG ! tag:example.com,2000:app/ +--- +!foo "bar" + +=====================================output===================================== +# Private +--- +!foo "bar" +... +# Global +%TAG ! tag:example.com,2000:app/ +--- +!foo "bar" + +================================================================================ +`; + +exports[`snippet: 6WPF.yaml - Spec Example 6.8. Flow Folding [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +" + foo + + bar + + baz +" + +=====================================output===================================== +--- +" +foo + +bar + +baz +" + +================================================================================ +`; + +exports[`snippet: 6XDY.yaml - Two document start markers format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +--- + +=====================================output===================================== +--- +--- + +================================================================================ +`; + +exports[`snippet: 6ZKB.yaml - Spec Example 9.6. Stream format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +Document +--- +# Empty +... +%YAML 1.2 +--- +matches %: 20 + +=====================================output===================================== +Document +--- +# Empty +... +%YAML 1.2 +--- +matches %: 20 + +================================================================================ +`; + +exports[`snippet: 7A4E.yaml - Spec Example 7.6. Double Quoted Lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +" 1st non-empty + + 2nd non-empty + 3rd non-empty " + +=====================================output===================================== +" 1st non-empty + +2nd non-empty +3rd non-empty " + +================================================================================ +`; + +exports[`snippet: 7BMT.yaml - Node and Mapping Key Anchors [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +top1: &node1 + &k1 key1: one +top2: &node2 # comment + key2: two +top3: + &k3 key3: three +top4: &node4 + &k4 key4: four +top5: &node5 + key5: five +top6: &val6 + six +top7: + &val7 seven + +=====================================output===================================== +--- +top1: &node1 + &k1 key1: one +top2: &node2 # comment + key2: two +top3: + &k3 key3: three +top4: &node4 + &k4 key4: four +top5: &node5 + key5: five +top6: &val6 six +top7: &val7 seven + +================================================================================ +`; + +exports[`snippet: 7BUB.yaml - Spec Example 2.10. Node for “Sammy Sosa” appears twice in this document format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +hr: + - Mark McGwire + # Following node labeled SS + - &SS Sammy Sosa +rbi: + - *SS # Subsequent occurrence + - Ken Griffey + +=====================================output===================================== +--- +hr: + - Mark McGwire + # Following node labeled SS + - &SS Sammy Sosa +rbi: + - *SS # Subsequent occurrence + - Ken Griffey + +================================================================================ +`; + +exports[`snippet: 7FWL.yaml - Spec Example 6.24. Verbatim Tags format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +! foo : + ! baz + +=====================================output===================================== +! foo: ! baz + +================================================================================ +`; + +exports[`snippet: 7T8X.yaml - Spec Example 8.10. Folded Lines - 8.13. Final Empty Lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +> + + folded + line + + next + line + * bullet + + * list + * lines + + last + line + +# Comment + +=====================================output===================================== +> + + folded + line + + next + line + * bullet + + * list + * lines + + last + line + +# Comment + +================================================================================ +`; + +exports[`snippet: 7TMG.yaml - Comment in flow sequence before comma format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +[ word1 +# comment +, word2] + +=====================================output===================================== +--- +[ + word1, + # comment + word2, +] + +================================================================================ +`; + +exports[`snippet: 7W2P.yaml - Block Mapping with Missing Values format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? a +? b +c: + +=====================================output===================================== +a: +b: +c: + +================================================================================ +`; + +exports[`snippet: 7Z25.yaml - Bare document after document end marker format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +scalar1 +... +key: value + +=====================================output===================================== +--- +scalar1 +... +key: value + +================================================================================ +`; + +exports[`snippet: 7ZZ5.yaml - Empty flow collections format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +nested sequences: +- - - [] +- - - {} +key1: [] +key2: {} + +=====================================output===================================== +--- +nested sequences: + - - - [] + - - - {} +key1: [] +key2: {} + +================================================================================ +`; + +exports[`snippet: 8CWC.yaml - Plain mapping key ending with colon format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +key ends with two colons::: value + +=====================================output===================================== +--- +key ends with two colons::: value + +================================================================================ +`; + +exports[`snippet: 8G76.yaml - Spec Example 6.10. Comment Lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + # Comment + + + + +=====================================output===================================== +# Comment + +================================================================================ +`; + +exports[`snippet: 8KB6.yaml - Multiline plain flow mapping key without value format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +- { single line, a: b} +- { multi + line, a: b} + +=====================================output===================================== +--- +- { single line, a: b } +- { + multi + line, + a: b, + } + +================================================================================ +`; + +exports[`snippet: 8MK2.yaml - Explicit Non-Specific Tag format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +! a + +=====================================output===================================== +! a + +================================================================================ +`; + +exports[`snippet: 8QBE.yaml - Block Sequence in Block Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +key: + - item1 + - item2 + +=====================================output===================================== +key: + - item1 + - item2 + +================================================================================ +`; + +exports[`snippet: 8UDB.yaml - Spec Example 7.14. Flow Sequence Entries format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +[ +"double + quoted", 'single + quoted', +plain + text, [ nested ], +single: pair, +] + +=====================================output===================================== +[ + "double + quoted", + "single + quoted", + plain + text, + [nested], + single: pair, +] + +================================================================================ +`; + +exports[`snippet: 8XYN.yaml - Anchor with unicode character format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +- &😁 unicode anchor + +=====================================output===================================== +--- +- &😁 unicode anchor + +================================================================================ +`; + +exports[`snippet: 9BXH.yaml - Multiline doublequoted flow mapping key without value format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +- { "single line", a: b} +- { "multi + line", a: b} + +=====================================output===================================== +--- +- { "single line", a: b } +- { + "multi + line", + a: b, + } + +================================================================================ +`; + +exports[`snippet: 9DXL.yaml - Spec Example 9.6. Stream [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +Mapping: Document +--- +# Empty +... +%YAML 1.2 +--- +matches %: 20 + +=====================================output===================================== +Mapping: Document +--- +# Empty +... +%YAML 1.2 +--- +matches %: 20 + +================================================================================ +`; + +exports[`snippet: 9FMG.yaml - Multi-level Mapping Indent format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: + b: + c: d + e: + f: g +h: i + +=====================================output===================================== +a: + b: + c: d + e: + f: g +h: i + +================================================================================ +`; + +exports[`snippet: 9J7A.yaml - Simple Mapping Indent format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: + bar: baz + +=====================================output===================================== +foo: + bar: baz + +================================================================================ +`; + +exports[`snippet: 9KAX.yaml - Various combinations of tags and anchors format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +&a1 +!!str +scalar1 +--- +!!str +&a2 +scalar2 +--- +&a3 +!!str scalar3 +--- +&a4 !!map +&a5 !!str key5: value4 +--- +a6: 1 +&anchor6 b6: 2 +--- +!!map +&a8 !!str key8: value7 +--- +!!map +!!str &a10 key10: value9 +--- +!!str &a11 +value11 + +=====================================output===================================== +--- +!!str &a1 scalar1 +--- +!!str &a2 scalar2 +--- +!!str &a3 scalar3 +--- +!!map &a4 +!!str &a5 key5: value4 +--- +a6: 1 +&anchor6 b6: 2 +--- +!!map +!!str &a8 key8: value7 +--- +!!map +!!str &a10 key10: value9 +--- +!!str &a11 value11 + +================================================================================ +`; + +exports[`snippet: 9MMW.yaml - Single Pair Implicit Entries format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- [ YAML : separate ] +- [ "JSON like":adjacent ] +- [ {JSON: like}:adjacent ] + +=====================================output===================================== +- [YAML: separate] +- ["JSON like": adjacent] +- [{ JSON: like }: adjacent] + +================================================================================ +`; + +exports[`snippet: 9MQT.yaml - Scalar doc with '...' in content format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- "a +...x +b" + +=====================================output===================================== +--- +"a +...x +b" + +================================================================================ +`; + +exports[`snippet: 9SA2.yaml - Multiline double quoted flow mapping key format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +- { "single line": value} +- { "multi + line": value} + +=====================================output===================================== +--- +- { "single line": value } +- { ? "multi + line" + : value } + +================================================================================ +`; + +exports[`snippet: 9SHH.yaml - Spec Example 5.8. Quoted Scalar Indicators format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +single: 'text' +double: "text" + +=====================================output===================================== +single: "text" +double: "text" + +================================================================================ +`; + +exports[`snippet: 9TFX.yaml - Spec Example 7.6. Double Quoted Lines [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +" 1st non-empty + + 2nd non-empty + 3rd non-empty " + +=====================================output===================================== +--- +" 1st non-empty + +2nd non-empty +3rd non-empty " + +================================================================================ +`; + +exports[`snippet: 9U5K.yaml - Spec Example 2.12. Compact Nested Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +# Products purchased +- item : Super Hoop + quantity: 1 +- item : Basketball + quantity: 4 +- item : Big Shoes + quantity: 1 + +=====================================output===================================== +--- +# Products purchased +- item: Super Hoop + quantity: 1 +- item: Basketball + quantity: 4 +- item: Big Shoes + quantity: 1 + +================================================================================ +`; + +exports[`snippet: 9WXW.yaml - Spec Example 6.18. Primary Tag Handle format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# Private +!foo "bar" +... +# Global +%TAG ! tag:example.com,2000:app/ +--- +!foo "bar" + +=====================================output===================================== +# Private +!foo "bar" +... +# Global +%TAG ! tag:example.com,2000:app/ +--- +!foo "bar" + +================================================================================ +`; + +exports[`snippet: 9YRD.yaml - Multiline Scalar at Top Level format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a +b + c +d + +e + +=====================================output===================================== +a +b +c +d + +e + +================================================================================ +`; + +exports[`snippet: 26DV.yaml - Whitespace around colon in mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"top1" : + "key1" : &alias1 scalar1 +'top2' : + 'key2' : &alias2 scalar2 +top3: &node3 + *alias1 : scalar3 +top4: + *alias2 : scalar4 +top5 : + scalar5 +top6: + &anchor6 'key6' : scalar6 + +=====================================output===================================== +"top1": + "key1": &alias1 scalar1 +"top2": + "key2": &alias2 scalar2 +top3: &node3 + *alias1 : scalar3 +top4: + *alias2 : scalar4 +top5: scalar5 +top6: + &anchor6 "key6": scalar6 + +================================================================================ +`; + +exports[`snippet: 27NA.yaml - Spec Example 5.9. Directive Indicator format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAML 1.2 +--- text + +=====================================output===================================== +%YAML 1.2 +--- +text + +================================================================================ +`; + +exports[`snippet: 33X3.yaml - Three explicit integers in a block sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +- !!int 1 +- !!int -2 +- !!int 33 + +=====================================output===================================== +--- +- !!int 1 +- !!int -2 +- !!int 33 + +================================================================================ +`; + +exports[`snippet: 35KP.yaml - Tags for Root Objects format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- !!map +? a +: b +--- !!seq +- !!str c +--- !!str +d +e + +=====================================output===================================== +--- +!!map +a: b +--- +!!seq +- !!str c +--- +!!str d +e + +================================================================================ +`; + +exports[`snippet: 36F6.yaml - Multiline plain scalar with empty line format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +plain: a + b + + c + +=====================================output===================================== +--- +plain: a + b + + c + +================================================================================ +`; + +exports[`snippet: 52DL.yaml - Explicit Non-Specific Tag [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +! a + +=====================================output===================================== +--- +! a + +================================================================================ +`; + +exports[`snippet: 54T7.yaml - Flow Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{foo: you, bar: far} + +=====================================output===================================== +{ foo: you, bar: far } + +================================================================================ +`; + +exports[`snippet: 57H4.yaml - Spec Example 8.22. Block Collection Nodes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +sequence: !!seq +- entry +- !!seq + - nested +mapping: !!map + foo: bar + +=====================================output===================================== +sequence: !!seq + - entry + - !!seq + - nested +mapping: !!map + foo: bar + +================================================================================ +`; + +exports[`snippet: 58MP.yaml - Flow mapping edge cases format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{x: :x} + +=====================================output===================================== +{ x: :x } + +================================================================================ +`; + +exports[`snippet: 65WH.yaml - Single Entry Block Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- foo + +=====================================output===================================== +- foo + +================================================================================ +`; + +exports[`snippet: 74H7.yaml - Tags in Implicit Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +!!str a: b +c: !!int 42 +e: !!str f +g: h +!!str 23: !!bool false + +=====================================output===================================== +!!str a: b +c: !!int 42 +e: !!str f +g: h +!!str 23: !!bool false + +================================================================================ +`; + +exports[`snippet: 82AN.yaml - Three dashes and content without space format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +---word1 +word2 + +=====================================output===================================== +---word1 +word2 + +================================================================================ +`; + +exports[`snippet: 87E4.yaml - Spec Example 7.8. Single Quoted Implicit Keys format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +'implicit block key' : [ + 'implicit flow key' : value, + ] + +=====================================output===================================== +"implicit block key": ["implicit flow key": value] + +================================================================================ +`; + +exports[`snippet: 93JH.yaml - Block Mappings in Block Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + - key: value + key2: value2 + - + key3: value3 + +=====================================output===================================== +- key: value + key2: value2 +- key3: value3 + +================================================================================ +`; + +exports[`snippet: 93WF.yaml - Spec Example 6.6. Line Folding [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- >- + trimmed + + + + as + space + +=====================================output===================================== +--- +>- + trimmed + + + + as + space + +================================================================================ +`; + +exports[`snippet: 96L6.yaml - Spec Example 2.14. In the folded scalars, newlines become spaces format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- > + Mark McGwire's + year was crippled + by a knee injury. + +=====================================output===================================== +--- +> + Mark McGwire's + year was crippled + by a knee injury. + +================================================================================ +`; + +exports[`snippet: 96NN.yaml - Leading tab content in literals format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: |- + bar + +=====================================output===================================== +foo: |- + bar + +================================================================================ +`; + +exports[`snippet: 96NN-2.yaml - Leading tab content in literals(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: |- + bar +=====================================output===================================== +foo: |- + bar + +================================================================================ +`; + +exports[`snippet: 98YD.yaml - Spec Example 5.5. Comment Indicator format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# Comment only. + +=====================================output===================================== +# Comment only. + +================================================================================ +`; + +exports[`snippet: 229Q.yaml - Spec Example 2.4. Sequence of Mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- + name: Mark McGwire + hr: 65 + avg: 0.278 +- + name: Sammy Sosa + hr: 63 + avg: 0.288 + +=====================================output===================================== +- name: Mark McGwire + hr: 65 + avg: 0.278 +- name: Sammy Sosa + hr: 63 + avg: 0.288 + +================================================================================ +`; + +exports[`snippet: 565N.yaml - Construct Binary format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +canonical: !!binary "\\ + R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\\ + OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\\ + +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\\ + AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=" +generic: !!binary | + R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5 + OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+ + +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC + AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs= +description: + The binary value above is a tiny arrow encoded as a gif image. + +=====================================output===================================== +canonical: !!binary "\\ + R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\\ + OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\\ + +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\\ + AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=" +generic: !!binary | + R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5 + OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+ + +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC + AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs= +description: The binary value above is a tiny arrow encoded as a gif image. + +================================================================================ +`; + +exports[`snippet: 652Z.yaml - Question mark at start of flow key format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ ?foo: bar, +bar: 42 +} + +=====================================output===================================== +{ ?foo: bar, bar: 42 } + +================================================================================ +`; + +exports[`snippet: 735Y.yaml - Spec Example 8.20. Block Node Types format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- + "flow in block" +- > + Block scalar +- !!map # Block collection + foo : bar + +=====================================output===================================== +- "flow in block" +- > + Block scalar +- !!map # Block collection + foo: bar + +================================================================================ +`; + +exports[`snippet: 753E.yaml - Block Scalar Strip [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- |- + ab + + +... + +=====================================output===================================== +--- +|- + ab +... + +================================================================================ +`; + +exports[`snippet: A2M4.yaml - Spec Example 6.2. Indentation Indicators format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? a +: - b + - - c + - d + +=====================================output===================================== +a: + - b + - - c + - d + +================================================================================ +`; + +exports[`snippet: A6F9.yaml - Spec Example 8.4. Chomping Final Line Break format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +strip: |- + text +clip: | + text +keep: |+ + text + +=====================================output===================================== +strip: |- + text +clip: | + text +keep: |+ + text + +================================================================================ +`; + +exports[`snippet: A984.yaml - Multiline Scalar in Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: b + c +d: + e + f + +=====================================output===================================== +a: b + c +d: e + f + +================================================================================ +`; + +exports[`snippet: AB8U.yaml - Sequence entry that looks like two with wrong indentation format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- single multiline + - sequence entry + +=====================================output===================================== +- single multiline + - sequence entry + +================================================================================ +`; + +exports[`snippet: AVM7.yaml - Empty Stream format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + +=====================================output===================================== + +================================================================================ +`; + +exports[`snippet: AZ63.yaml - Sequence With Same Indentation as Parent Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +one: +- 2 +- 3 +four: 5 + +=====================================output===================================== +one: + - 2 + - 3 +four: 5 + +================================================================================ +`; + +exports[`snippet: AZW3.yaml - Lookahead test cases format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- bla"keks: foo +- bla]keks: foo + +=====================================output===================================== +- bla"keks: foo +- bla]keks: foo + +================================================================================ +`; + +exports[`snippet: B3HG.yaml - Spec Example 8.9. Folded Scalar [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- > + folded + text + + + +=====================================output===================================== +--- +> + folded + text + +================================================================================ +`; + +exports[`snippet: BEC7.yaml - Spec Example 6.14. “YAML” directive format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAML 1.3 # Attempt parsing + # with a warning +--- +"foo" + +=====================================output===================================== +%YAML 1.3 # Attempt parsing +# with a warning +--- +"foo" + +================================================================================ +`; + +exports[`snippet: BU8L.yaml - Node Anchor and Tag on Seperate Lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +key: &anchor + !!map + a: b + +=====================================output===================================== +key: !!map &anchor + a: b + +================================================================================ +`; + +exports[`snippet: C2DT.yaml - Spec Example 7.18. Flow Mapping Adjacent Values format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ +"adjacent":value, +"readable": value, +"empty": +} + +=====================================output===================================== +{ "adjacent": value, "readable": value, "empty" } + +================================================================================ +`; + +exports[`snippet: C4HZ.yaml - Spec Example 2.24. Global Tags format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%TAG ! tag:clarkevans.com,2002: +--- !shape + # Use the ! handle for presenting + # tag:clarkevans.com,2002:circle +- !circle + center: &ORIGIN {x: 73, y: 129} + radius: 7 +- !line + start: *ORIGIN + finish: { x: 89, y: 102 } +- !label + start: *ORIGIN + color: 0xFFEEBB + text: Pretty vector drawing. + +=====================================output===================================== +%TAG ! tag:clarkevans.com,2002: +--- +!shape +# Use the ! handle for presenting +# tag:clarkevans.com,2002:circle +- !circle + center: &ORIGIN { x: 73, y: 129 } + radius: 7 +- !line + start: *ORIGIN + finish: { x: 89, y: 102 } +- !label + start: *ORIGIN + color: 0xFFEEBB + text: Pretty vector drawing. + +================================================================================ +`; + +exports[`snippet: CC74.yaml - Spec Example 6.20. Tag Handles format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%TAG !e! tag:example.com,2000:app/ +--- +!e!foo "bar" + +=====================================output===================================== +%TAG !e! tag:example.com,2000:app/ +--- +!e!foo "bar" + +================================================================================ +`; + +exports[`snippet: CFD4.yaml - Empty implicit key in single pair flow sequences format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- [ : empty key ] +- [: another empty key] + +=====================================output===================================== +- [: empty key] +- [: another empty key] + +================================================================================ +`; + +exports[`snippet: CN3R.yaml - Various location of anchors in flow sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +&flowseq [ + a: b, + &c c: d, + { &e e: f }, + &g { g: h } +] + +=====================================output===================================== +&flowseq [a: b, &c c: d, { &e e: f }, &g { g: h }] + +================================================================================ +`; + +exports[`snippet: CPZ3.yaml - Doublequoted scalar starting with a tab format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +tab: "\\tstring" + +=====================================output===================================== +--- +tab: "\\tstring" + +================================================================================ +`; + +exports[`snippet: CT4Q.yaml - Spec Example 7.20. Single Pair Explicit Entry format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +[ +? foo + bar : baz +] + +=====================================output===================================== +[? foo + bar + : baz] + +================================================================================ +`; + +exports[`snippet: CUP7.yaml - Spec Example 5.6. Node Property Indicators format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +anchored: !local &anchor value +alias: *anchor + +=====================================output===================================== +anchored: !local &anchor value +alias: *anchor + +================================================================================ +`; + +exports[`snippet: D9TU.yaml - Single Pair Block Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: bar + +=====================================output===================================== +foo: bar + +================================================================================ +`; + +exports[`snippet: D83L.yaml - Block scalar indicator order format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- |2- + explicit indent and chomp +- |-2 + chomp and explicit indent + +=====================================output===================================== +- |2- + explicit indent and chomp +- |2- + chomp and explicit indent + +================================================================================ +`; + +exports[`snippet: D88J.yaml - Flow Sequence in Block Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: [b, c] + +=====================================output===================================== +a: [b, c] + +================================================================================ +`; + +exports[`snippet: DBG4.yaml - Spec Example 7.10. Plain Characters format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# Outside flow collection: +- ::vector +- ": - ()" +- Up, up, and away! +- -123 +- http://example.com/foo#bar +# Inside flow collection: +- [ ::vector, + ": - ()", + "Up, up and away!", + -123, + http://example.com/foo#bar ] + +=====================================output===================================== +# Outside flow collection: +- ::vector +- ": - ()" +- Up, up, and away! +- -123 +- http://example.com/foo#bar +# Inside flow collection: +- [::vector, ": - ()", "Up, up and away!", -123, http://example.com/foo#bar] + +================================================================================ +`; + +exports[`snippet: DC7X.yaml - Various trailing tabs format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: b +seq: + - a +c: d #X + +=====================================output===================================== +a: b +seq: + - a +c: d #X + +================================================================================ +`; + +exports[`snippet: DE56.yaml - Trailing tabs in double quoted format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"1 trailing\\t + tab" + +=====================================output===================================== +"1 trailing\\t +tab" + +================================================================================ +`; + +exports[`snippet: DE56-2.yaml - Trailing tabs in double quoted(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"2 trailing\\t + tab" + +=====================================output===================================== +"2 trailing\\t +tab" + +================================================================================ +`; + +exports[`snippet: DE56-5.yaml - Trailing tabs in double quoted(5) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"5 trailing + tab" + +=====================================output===================================== +"5 trailing +tab" + +================================================================================ +`; + +exports[`snippet: DE56-6.yaml - Trailing tabs in double quoted(6) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"6 trailing + tab" + +=====================================output===================================== +"6 trailing +tab" + +================================================================================ +`; + +exports[`snippet: DFF7.yaml - Spec Example 7.16. Flow Mapping Entries format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ +? explicit: entry, +implicit: entry, +? +} + +=====================================output===================================== +{ explicit: entry, implicit: entry, : } + +================================================================================ +`; + +exports[`snippet: DHP8.yaml - Flow Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +[foo, bar, 42] + +=====================================output===================================== +[foo, bar, 42] + +================================================================================ +`; + +exports[`snippet: DK3J.yaml - Zero indented block scalar with line that looks like a comment format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- > +line1 +# no comment +line3 + +=====================================output===================================== +--- +> + line1 + # no comment + line3 + +================================================================================ +`; + +exports[`snippet: DK95-3.yaml - Tabs that look like indentation(3) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: "bar + baz" + +=====================================output===================================== +foo: "bar + baz" + +================================================================================ +`; + +exports[`snippet: DK95-4.yaml - Tabs that look like indentation(4) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + +foo: 1 + +=====================================output===================================== +foo: 1 + +================================================================================ +`; + +exports[`snippet: DK95-5.yaml - Tabs that look like indentation(5) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: 1 + +bar: 2 + +=====================================output===================================== +foo: 1 + +bar: 2 + +================================================================================ +`; + +exports[`snippet: DK95-6.yaml - Tabs that look like indentation(6) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: 1 + +bar: 2 + +=====================================output===================================== +foo: 1 + +bar: 2 + +================================================================================ +`; + +exports[`snippet: DK95-8.yaml - Tabs that look like indentation(8) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAML 1.2 + +--- + +=====================================output===================================== +%YAML 1.2 +--- + +================================================================================ +`; + +exports[`snippet: DK95-9.yaml - Tabs that look like indentation(9) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: "bar + baz " + +=====================================output===================================== +foo: "bar + baz " + +================================================================================ +`; + +exports[`snippet: DWX9.yaml - Spec Example 8.8. Literal Content format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +| + + + literal + + + text + + # Comment + +=====================================output===================================== +| + + + literal + + + text + +# Comment + +================================================================================ +`; + +exports[`snippet: E76Z.yaml - Aliases in Implicit Block Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +&a a: &b b +*b : *a + +=====================================output===================================== +&a a: &b b +*b : *a + +================================================================================ +`; + +exports[`snippet: EHF6.yaml - Tags for Flow Objects format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +!!map { + k: !!seq + [ a, !!str b] +} + +=====================================output===================================== +!!map { k: !!seq [a, !!str b] } + +================================================================================ +`; + +exports[`snippet: EX5H.yaml - Multiline Scalar at Top Level [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +a +b + c +d + +e + +=====================================output===================================== +--- +a +b +c +d + +e + +================================================================================ +`; + +exports[`snippet: EXG3.yaml - Three dashes and content without space [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +---word1 +word2 + +=====================================output===================================== +--- +---word1 +word2 + +================================================================================ +`; + +exports[`snippet: F2C7.yaml - Anchors and Tags format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + - &a !!str a + - !!int 2 + - !!int &c 4 + - &d d + +=====================================output===================================== +- !!str &a a +- !!int 2 +- !!int &c 4 +- &d d + +================================================================================ +`; + +exports[`snippet: F3CP.yaml - Nested flow collections on one line format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +{ a: [b, c, { d: [e, f] } ] } + +=====================================output===================================== +--- +{ a: [b, c, { d: [e, f] }] } + +================================================================================ +`; + +exports[`snippet: F6MC.yaml - More indented lines at the beginning of folded block scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +a: >2 + more indented + regular +b: >2 + + + more indented + regular + +=====================================output===================================== +--- +a: >2 + more indented + regular +b: >2 + + + more indented + regular + +================================================================================ +`; + +exports[`snippet: F8F9.yaml - Spec Example 8.5. Chomping Trailing Lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + # Strip + # Comments: +strip: |- + # text + + # Clip + # comments: + +clip: | + # text + + # Keep + # comments: + +keep: |+ + # text + + # Trail + # comments. + +=====================================output===================================== +# Strip +# Comments: +strip: |- + # text + +# Clip +# comments: + +clip: | + # text + +# Keep +# comments: + +keep: |+ + # text + +# Trail +# comments. +================================================================================ +`; + +exports[`snippet: FBC9.yaml - Allowed characters in plain scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +safe: a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_\`az{|}~ + !"#$%&'()*+,-./09:;<=>?@AZ[\\]^_\`az{|}~ +safe question mark: ?foo +safe colon: :foo +safe dash: -foo + +=====================================output===================================== +safe: a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_\`az{|}~ + !"#$%&'()*+,-./09:;<=>?@AZ[\\]^_\`az{|}~ +safe question mark: ?foo +safe colon: :foo +safe dash: -foo + +================================================================================ +`; + +exports[`snippet: FH7J.yaml - Tags on Empty Scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- !!str +- + !!null : a + b: !!str +- !!str : !!null + +=====================================output===================================== +- !!str +- !!null : a + b: !!str +- !!str : !!null + +================================================================================ +`; + +exports[`snippet: FP8R.yaml - Zero indented block scalar format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- > +line1 +line2 +line3 + +=====================================output===================================== +--- +> + line1 + line2 + line3 + +================================================================================ +`; + +exports[`snippet: FQ7F.yaml - Spec Example 2.1. Sequence of Scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +=====================================output===================================== +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +================================================================================ +`; + +exports[`snippet: FRK4.yaml - Spec Example 7.3. Completely Empty Flow Nodes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ + ? foo :, + : bar, +} + +=====================================output===================================== +{ foo, : bar } + +================================================================================ +`; + +exports[`snippet: FTA2.yaml - Single block sequence with anchor and explicit document start format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- &sequence +- a + +=====================================output===================================== +--- +&sequence +- a + +================================================================================ +`; + +exports[`snippet: FUP4.yaml - Flow Sequence in Flow Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +[a, [b, c]] + +=====================================output===================================== +[a, [b, c]] + +================================================================================ +`; + +exports[`snippet: G4RS.yaml - Spec Example 2.17. Quoted Scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +unicode: "Sosa did fine.\\u263A" +control: "\\b1998\\t1999\\t2000\\n" +hex esc: "\\x0d\\x0a is \\r\\n" + +single: '"Howdy!" he cried.' +quoted: ' # Not a ''comment''.' +tie-fighter: '|\\-*-/|' + +=====================================output===================================== +unicode: "Sosa did fine.\\u263A" +control: "\\b1998\\t1999\\t2000\\n" +hex esc: "\\x0d\\x0a is \\r\\n" + +single: '"Howdy!" he cried.' +quoted: " # Not a 'comment'." +tie-fighter: '|\\-*-/|' + +================================================================================ +`; + +exports[`snippet: G992.yaml - Spec Example 8.9. Folded Scalar format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +> + folded + text + + + +=====================================output===================================== +> + folded + text + +================================================================================ +`; + +exports[`snippet: GH63.yaml - Mixed Block Mapping (explicit to implicit) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? a +: 1.3 +fifteen: d + +=====================================output===================================== +a: 1.3 +fifteen: d + +================================================================================ +`; + +exports[`snippet: H2RW.yaml - Blank lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: 1 + +bar: 2 + +text: | + a + + b + + c + + d + +=====================================output===================================== +foo: 1 + +bar: 2 + +text: | + a + + b + + c + + d + +================================================================================ +`; + +exports[`snippet: H3Z8.yaml - Literal unicode format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +wanted: love ♥ and peace ☮ + +=====================================output===================================== +--- +wanted: love ♥ and peace ☮ + +================================================================================ +`; + +exports[`snippet: HM87.yaml - Scalars in flow start with syntax char format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +[:x] + +=====================================output===================================== +[:x] + +================================================================================ +`; + +exports[`snippet: HM87-2.yaml - Scalars in flow start with syntax char(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +[?x] + +=====================================output===================================== +[?x] + +================================================================================ +`; + +exports[`snippet: HMK4.yaml - Spec Example 2.16. Indentation determines scope format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +name: Mark McGwire +accomplishment: > + Mark set a major league + home run record in 1998. +stats: | + 65 Home Runs + 0.278 Batting Average + +=====================================output===================================== +name: Mark McGwire +accomplishment: > + Mark set a major league + home run record in 1998. +stats: | + 65 Home Runs + 0.278 Batting Average + +================================================================================ +`; + +exports[`snippet: HMQ5.yaml - Spec Example 6.23. Node Properties format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +!!str &a1 "foo": + !!str bar +&a2 baz : *a1 + +=====================================output===================================== +!!str &a1 "foo": !!str bar +&a2 baz: *a1 + +================================================================================ +`; + +exports[`snippet: HS5T.yaml - Spec Example 7.12. Plain Lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +1st non-empty + + 2nd non-empty + 3rd non-empty + +=====================================output===================================== +1st non-empty + +2nd non-empty +3rd non-empty + +================================================================================ +`; + +exports[`snippet: HWV9.yaml - Document-end marker format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +... + +=====================================output===================================== + +... + +================================================================================ +`; + +exports[`snippet: J3BT.yaml - Spec Example 5.12. Tabs and Spaces format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# Tabs and spaces +quoted: "Quoted " +block: | + void main() { + printf("Hello, world!\\n"); + } + +=====================================output===================================== +# Tabs and spaces +quoted: "Quoted " +block: | + void main() { + printf("Hello, world!\\n"); + } + +================================================================================ +`; + +exports[`snippet: J5UC.yaml - Multiple Pair Block Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: blue +bar: arrr +baz: jazz + +=====================================output===================================== +foo: blue +bar: arrr +baz: jazz + +================================================================================ +`; + +exports[`snippet: J7PZ.yaml - Spec Example 2.26. Ordered Mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# The !!omap tag is one of the optional types +# introduced for YAML 1.1. In 1.2, it is not +# part of the standard tags and should not be +# enabled by default. +# Ordered maps are represented as +# A sequence of mappings, with +# each mapping having one key +--- !!omap +- Mark McGwire: 65 +- Sammy Sosa: 63 +- Ken Griffy: 58 + +=====================================output===================================== +# The !!omap tag is one of the optional types +# introduced for YAML 1.1. In 1.2, it is not +# part of the standard tags and should not be +# enabled by default. +# Ordered maps are represented as +# A sequence of mappings, with +# each mapping having one key +--- +!!omap +- Mark McGwire: 65 +- Sammy Sosa: 63 +- Ken Griffy: 58 + +================================================================================ +`; + +exports[`snippet: J7VC.yaml - Empty Lines Between Mapping Elements format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +one: 2 + + +three: 4 + +=====================================output===================================== +one: 2 + +three: 4 + +================================================================================ +`; + +exports[`snippet: J9HZ.yaml - Spec Example 2.9. Single Document with Two Comments format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +hr: # 1998 hr ranking + - Mark McGwire + - Sammy Sosa +rbi: + # 1998 rbi ranking + - Sammy Sosa + - Ken Griffey + +=====================================output===================================== +--- +hr: # 1998 hr ranking + - Mark McGwire + - Sammy Sosa +rbi: + # 1998 rbi ranking + - Sammy Sosa + - Ken Griffey + +================================================================================ +`; + +exports[`snippet: JEF9.yaml - Trailing whitespace in streams format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- |+ + + + +=====================================output===================================== +- |+ + + + +================================================================================ +`; + +exports[`snippet: JHB9.yaml - Spec Example 2.7. Two Documents in a Stream format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# Ranking of 1998 home runs +--- +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +# Team ranking +--- +- Chicago Cubs +- St Louis Cardinals + +=====================================output===================================== +# Ranking of 1998 home runs +--- +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +# Team ranking +--- +- Chicago Cubs +- St Louis Cardinals + +================================================================================ +`; + +exports[`snippet: JQ4R.yaml - Spec Example 8.14. Block Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +block sequence: + - one + - two : three + +=====================================output===================================== +block sequence: + - one + - two: three + +================================================================================ +`; + +exports[`snippet: JR7V.yaml - Question marks in scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- a?string +- another ? string +- key: value? +- [a?string] +- [another ? string] +- {key: value? } +- {key: value?} +- {key?: value } + +=====================================output===================================== +- a?string +- another ? string +- key: value? +- [a?string] +- [another ? string] +- { key: value? } +- { key: value? } +- { key?: value } + +================================================================================ +`; + +exports[`snippet: JS2J.yaml - Spec Example 6.29. Node Anchors format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +First occurrence: &anchor Value +Second occurrence: *anchor + +=====================================output===================================== +First occurrence: &anchor Value +Second occurrence: *anchor + +================================================================================ +`; + +exports[`snippet: JTV5.yaml - Block Mapping with Multiline Scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? a + true +: null + d +? e + 42 + +=====================================output===================================== +? a + true +: null + d +? e + 42 + +================================================================================ +`; + +exports[`snippet: K4SU.yaml - Multiple Entry Block Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- foo +- bar +- 42 + +=====================================output===================================== +- foo +- bar +- 42 + +================================================================================ +`; + +exports[`snippet: K54U.yaml - Tab after document header format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- scalar + +=====================================output===================================== +--- +scalar + +================================================================================ +`; + +exports[`snippet: K527.yaml - Spec Example 6.6. Line Folding format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +>- + trimmed + + + + as + space + +=====================================output===================================== +>- + trimmed + + + + as + space + +================================================================================ +`; + +exports[`snippet: K858.yaml - Spec Example 8.6. Empty Scalar Chomping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +strip: >- + +clip: > + +keep: |+ + + +=====================================output===================================== +strip: >- + +clip: > + +keep: |+ + + +================================================================================ +`; + +exports[`snippet: KH5V.yaml - Inline tabs in double quoted format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"1 inline\\ttab" + +=====================================output===================================== +"1 inline\\ttab" + +================================================================================ +`; + +exports[`snippet: KH5V-2.yaml - Inline tabs in double quoted(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"2 inline\\ tab" + +=====================================output===================================== +"2 inline\\ tab" + +================================================================================ +`; + +exports[`snippet: KH5V-3.yaml - Inline tabs in double quoted(3) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"3 inline tab" + +=====================================output===================================== +"3 inline tab" + +================================================================================ +`; + +exports[`snippet: KK5P.yaml - Various combinations of explicit block mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +complex1: + ? - a +complex2: + ? - a + : b +complex3: + ? - a + : > + b +complex4: + ? > + a + : +complex5: + ? - a + : - b + +=====================================output===================================== +complex1: + ? - a +complex2: + ? - a + : b +complex3: + ? - a + : > + b +complex4: + ? > + a +complex5: + ? - a + : - b + +================================================================================ +`; + +exports[`snippet: KMK3.yaml - Block Submapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: + bar: 1 +baz: 2 + +=====================================output===================================== +foo: + bar: 1 +baz: 2 + +================================================================================ +`; + +exports[`snippet: KSS4.yaml - Scalars on --- line format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- "quoted +string" +--- &node foo + +=====================================output===================================== +--- +"quoted +string" +--- +&node foo + +================================================================================ +`; + +exports[`snippet: L9U5.yaml - Spec Example 7.11. Plain Implicit Keys format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +implicit block key : [ + implicit flow key : value, + ] + +=====================================output===================================== +implicit block key: [implicit flow key: value] + +================================================================================ +`; + +exports[`snippet: L24T.yaml - Trailing line of spaces format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: | + x + + +=====================================output===================================== +foo: | + x + +================================================================================ +`; + +exports[`snippet: L94M.yaml - Tags in Explicit Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? !!str a +: !!int 47 +? c +: !!str d + +=====================================output===================================== +!!str a: !!int 47 +c: !!str d + +================================================================================ +`; + +exports[`snippet: L383.yaml - Two scalar docs with trailing comments format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- foo # comment +--- foo # comment + +=====================================output===================================== +--- +foo # comment +--- +foo # comment + +================================================================================ +`; + +exports[`snippet: LE5A.yaml - Spec Example 7.24. Flow Nodes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- !!str "a" +- 'b' +- &anchor "c" +- *anchor +- !!str + +=====================================output===================================== +- !!str "a" +- "b" +- &anchor "c" +- *anchor +- !!str + +================================================================================ +`; + +exports[`snippet: LP6E.yaml - Whitespace After Scalars in Flow format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- [a, b , c ] +- { "a" : b + , c : 'd' , + e : "f" + } +- [ ] + +=====================================output===================================== +- [a, b, c] +- { "a": b, c: "d", e: "f" } +- [] + +================================================================================ +`; + +exports[`snippet: LQZ7.yaml - Spec Example 7.4. Double Quoted Implicit Keys format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"implicit block key" : [ + "implicit flow key" : value, + ] + +=====================================output===================================== +"implicit block key": ["implicit flow key": value] + +================================================================================ +`; + +exports[`snippet: LX3P.yaml - Implicit Flow Mapping Key on one line format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +[flow]: block + +=====================================output===================================== +[flow]: block + +================================================================================ +`; + +exports[`snippet: M2N8.yaml - Question mark edge cases format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- ? : x + +=====================================output===================================== +- ? : x + +================================================================================ +`; + +exports[`snippet: M2N8-2.yaml - Question mark edge cases(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? []: x + +=====================================output===================================== +? []: x + +================================================================================ +`; + +exports[`snippet: M5C3.yaml - Spec Example 8.21. Block Scalar Nodes format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +literal: |2 + value +folded: + !foo + >1 + value + +=====================================output===================================== +literal: |2 + value +folded: !foo >1 + value + +================================================================================ +`; + +exports[`snippet: M5DY.yaml - Spec Example 2.11. Mapping between Sequences format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +? - Detroit Tigers + - Chicago cubs +: + - 2001-07-23 + +? [ New York Yankees, + Atlanta Braves ] +: [ 2001-07-02, 2001-08-12, + 2001-08-14 ] + +=====================================output===================================== +? - Detroit Tigers + - Chicago cubs +: - 2001-07-23 + +[New York Yankees, Atlanta Braves]: [2001-07-02, 2001-08-12, 2001-08-14] + +================================================================================ +`; + +exports[`snippet: M6YH.yaml - Block sequence indentation format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- | + x +- + foo: bar +- + - 42 + +=====================================output===================================== +- | + x +- foo: bar +- - 42 + +================================================================================ +`; + +exports[`snippet: M7A3.yaml - Spec Example 9.3. Bare Documents format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +Bare +document +... +# No document +... +| +%!PS-Adobe-2.0 # Not the first line + +=====================================output===================================== +Bare +document +... +# No document +... +| + %!PS-Adobe-2.0 # Not the first line + +================================================================================ +`; + +exports[`snippet: M7NX.yaml - Nested flow collections format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +{ + a: [ + b, c, { + d: [e, f] + } + ] +} + +=====================================output===================================== +--- +{ a: [b, c, { d: [e, f] }] } + +================================================================================ +`; + +exports[`snippet: M9B4.yaml - Spec Example 8.7. Literal Scalar format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +| + literal + text + + + +=====================================output===================================== +| + literal + text + +================================================================================ +`; + +exports[`snippet: M29M.yaml - Literal Block Scalar format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: | + ab + + cd + ef + + +... + +=====================================output===================================== +a: | + ab + + cd + ef +... + +================================================================================ +`; + +exports[`snippet: MJS9.yaml - Spec Example 6.7. Block Folding format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +> + foo + + bar + + baz + +=====================================output===================================== +> + foo + + bar + + baz + +================================================================================ +`; + +exports[`snippet: MUS6-3.yaml - Directive variants(3) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAML 1.1 +--- + +=====================================output===================================== +%YAML 1.1 +--- + +================================================================================ +`; + +exports[`snippet: MUS6-4.yaml - Directive variants(4) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAML 1.1 +--- + +=====================================output===================================== +%YAML 1.1 +--- + +================================================================================ +`; + +exports[`snippet: MUS6-5.yaml - Directive variants(5) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAML 1.1 # comment +--- + +=====================================output===================================== +%YAML 1.1 # comment +--- + +================================================================================ +`; + +exports[`snippet: MUS6-6.yaml - Directive variants(6) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAM 1.1 +--- + +=====================================output===================================== +%YAM 1.1 +--- + +================================================================================ +`; + +exports[`snippet: MUS6-7.yaml - Directive variants(7) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAMLL 1.1 +--- + +=====================================output===================================== +%YAMLL 1.1 +--- + +================================================================================ +`; + +exports[`snippet: MXS3.yaml - Flow Mapping in Block Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- {a: b} + +=====================================output===================================== +- { a: b } + +================================================================================ +`; + +exports[`snippet: MYW6.yaml - Block Scalar Strip format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +|- + ab + + +... + +=====================================output===================================== +|- + ab +... + +================================================================================ +`; + +exports[`snippet: MZX3.yaml - Non-Specific Tags on Scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- plain +- "double quoted" +- 'single quoted' +- > + block +- plain again + +=====================================output===================================== +- plain +- "double quoted" +- "single quoted" +- > + block +- plain again + +================================================================================ +`; + +exports[`snippet: NAT4.yaml - Various empty or newline only quoted strings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +a: ' + ' +b: ' + ' +c: " + " +d: " + " +e: ' + + ' +f: " + + " +g: ' + + + ' +h: " + + + " + +=====================================output===================================== +--- +a: " + " +b: " + " +c: " + " +d: " + " +e: " + + " +f: " + + " +g: " + + + " +h: " + + + " + +================================================================================ +`; + +exports[`snippet: NB6Z.yaml - Multiline plain value with tabs on empty lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +key: + value + with + + tabs + +=====================================output===================================== +key: value + with + + tabs + +================================================================================ +`; + +exports[`snippet: NHX8.yaml - Empty Lines at End of Document format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +: + + + +=====================================output===================================== +: + +================================================================================ +`; + +exports[`snippet: NJ66.yaml - Multiline plain flow mapping key format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +- { single line: value} +- { multi + line: value} + +=====================================output===================================== +--- +- { single line: value } +- { ? multi + line + : value } + +================================================================================ +`; + +exports[`snippet: NKF9.yaml - Empty keys in block and flow mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +key: value +: empty key +--- +{ + key: value, : empty key +} +--- +# empty key and value +: +--- +# empty key and value +{ : } + +=====================================output===================================== +--- +key: value +: empty key +--- +{ key: value, : empty key } +--- +# empty key and value +: +--- +# empty key and value +{ : } + +================================================================================ +`; + +exports[`snippet: NP9H.yaml - Spec Example 7.5. Double Quoted Line Breaks format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +"folded +to a space, + +to a line feed, or \\ + \\ non-content" + +=====================================output===================================== +"folded +to a space, + +to a line feed, or \\ +\\ non-content" + +================================================================================ +`; + +exports[`snippet: P2AD.yaml - Spec Example 8.1. Block Scalar Header format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- | # Empty header↓ + literal +- >1 # Indentation indicator↓ + folded +- |+ # Chomping indicator↓ + keep + +- >1- # Both indicators↓ + strip + +=====================================output===================================== +- | # Empty header↓ + literal +- >1 # Indentation indicator↓ + folded +- |+ # Chomping indicator↓ + keep + +- >1- # Both indicators↓ + strip + +================================================================================ +`; + +exports[`snippet: P76L.yaml - Spec Example 6.19. Secondary Tag Handle format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%TAG !! tag:example.com,2000:app/ +--- +!!int 1 - 3 # Interval, not integer + +=====================================output===================================== +%TAG !! tag:example.com,2000:app/ +--- +!!int 1 - 3 # Interval, not integer + +================================================================================ +`; + +exports[`snippet: P94K.yaml - Spec Example 6.11. Multi-Line Comments format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +key: # Comment + # lines + value + + + +=====================================output===================================== +key: # Comment + # lines + value + +================================================================================ +`; + +exports[`snippet: PBJ2.yaml - Spec Example 2.3. Mapping Scalars to Sequences format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +american: + - Boston Red Sox + - Detroit Tigers + - New York Yankees +national: + - New York Mets + - Chicago Cubs + - Atlanta Braves + +=====================================output===================================== +american: + - Boston Red Sox + - Detroit Tigers + - New York Yankees +national: + - New York Mets + - Chicago Cubs + - Atlanta Braves + +================================================================================ +`; + +exports[`snippet: PRH3.yaml - Spec Example 7.9. Single Quoted Lines format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +' 1st non-empty + + 2nd non-empty + 3rd non-empty ' + +=====================================output===================================== +" 1st non-empty + +2nd non-empty +3rd non-empty " + +================================================================================ +`; + +exports[`snippet: PUW8.yaml - Document start on last line format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +a: b +--- + +=====================================output===================================== +--- +a: b +--- + +================================================================================ +`; + +exports[`snippet: PW8X.yaml - Anchors on Empty Scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- &a +- a +- + &a : a + b: &b +- + &c : &a +- + ? &d +- + ? &e + : &a + +=====================================output===================================== +- &a +- a +- &a : a + b: &b +- &c : &a +- &d : +- &e : &a + +================================================================================ +`; + +exports[`snippet: Q5MG.yaml - Tab at beginning of line followed by a flow mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== + {} + +=====================================output===================================== +{} + +================================================================================ +`; + +exports[`snippet: Q8AD.yaml - Spec Example 7.5. Double Quoted Line Breaks [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +"folded +to a space, + +to a line feed, or \\ + \\ non-content" + +=====================================output===================================== +--- +"folded +to a space, + +to a line feed, or \\ +\\ non-content" + +================================================================================ +`; + +exports[`snippet: Q9WF.yaml - Spec Example 6.12. Separation Spaces format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ first: Sammy, last: Sosa }: +# Statistics: + hr: # Home runs + 65 + avg: # Average + 0.278 + +=====================================output===================================== +{ first: Sammy, last: Sosa }: + # Statistics: + hr: # Home runs + 65 + avg: # Average + 0.278 + +================================================================================ +`; + +exports[`snippet: Q88A.yaml - Spec Example 7.23. Flow Content format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- [ a, b ] +- { a: b } +- "a" +- 'b' +- c + +=====================================output===================================== +- [a, b] +- { a: b } +- "a" +- "b" +- c + +================================================================================ +`; + +exports[`snippet: QF4Y.yaml - Spec Example 7.19. Single Pair Flow Mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +[ +foo: bar +] + +=====================================output===================================== +[foo: bar] + +================================================================================ +`; + +exports[`snippet: QT73.yaml - Comment and document-end marker format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# comment +... + +=====================================output===================================== +# comment +... + +================================================================================ +`; + +exports[`snippet: R4YG.yaml - Spec Example 8.2. Block Indentation Indicator format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- | + detected +- > + + + # detected +- |1 + explicit +- > + + detected + +=====================================output===================================== +- | + detected +- > + + + # detected +- |1 + explicit +- > + + detected + +================================================================================ +`; + +exports[`snippet: R52L.yaml - Nested flow mapping sequence and mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +{ top1: [item1, {key2: value2}, item3], top2: value2 } + +=====================================output===================================== +--- +{ top1: [item1, { key2: value2 }, item3], top2: value2 } + +================================================================================ +`; + +exports[`snippet: RLU9.yaml - Sequence Indent format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: +- 42 +bar: + - 44 + +=====================================output===================================== +foo: + - 42 +bar: + - 44 + +================================================================================ +`; + +exports[`snippet: RR7F.yaml - Mixed Block Mapping (implicit to explicit) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: 4.2 +? d +: 23 + +=====================================output===================================== +a: 4.2 +d: 23 + +================================================================================ +`; + +exports[`snippet: RTP8.yaml - Spec Example 9.2. Document Markers format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAML 1.2 +--- +Document +... # Suffix + +=====================================output===================================== +%YAML 1.2 +--- +Document +... # Suffix + +================================================================================ +`; + +exports[`snippet: RZP5.yaml - Various Trailing Comments [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: "double + quotes" # lala +b: plain + value # lala +c : #lala + d +? # lala + - seq1 +: # lala + - #lala + seq2 +e: &node # lala + - x: y +block: > # lala + abcde + +=====================================output===================================== +a: "double + quotes" # lala +b: plain + value # lala +c: #lala + d +? # lala + - seq1 +: # lala + - #lala + seq2 +e: &node # lala + - x: y +block: > # lala + abcde + +================================================================================ +`; + +exports[`snippet: RZT7.yaml - Spec Example 2.28. Log File format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +Time: 2001-11-23 15:01:42 -5 +User: ed +Warning: + This is an error message + for the log file +--- +Time: 2001-11-23 15:02:31 -5 +User: ed +Warning: + A slightly different error + message. +--- +Date: 2001-11-23 15:03:17 -5 +User: ed +Fatal: + Unknown variable "bar" +Stack: + - file: TopClass.py + line: 23 + code: | + x = MoreObject("345\\n") + - file: MoreClass.py + line: 58 + code: |- + foo = bar + +=====================================output===================================== +--- +Time: 2001-11-23 15:01:42 -5 +User: ed +Warning: This is an error message + for the log file +--- +Time: 2001-11-23 15:02:31 -5 +User: ed +Warning: A slightly different error + message. +--- +Date: 2001-11-23 15:03:17 -5 +User: ed +Fatal: Unknown variable "bar" +Stack: + - file: TopClass.py + line: 23 + code: | + x = MoreObject("345\\n") + - file: MoreClass.py + line: 58 + code: |- + foo = bar + +================================================================================ +`; + +exports[`snippet: S3PD.yaml - Spec Example 8.18. Implicit Block Mapping Entries format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +plain key: in-line value +: # Both empty +"quoted key": +- entry + +=====================================output===================================== +plain key: in-line value +: # Both empty +"quoted key": + - entry + +================================================================================ +`; + +exports[`snippet: S4JQ.yaml - Spec Example 6.28. Non-Specific Tags format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +# Assuming conventional resolution: +- "12" +- 12 +- ! 12 + +=====================================output===================================== +# Assuming conventional resolution: +- "12" +- 12 +- ! 12 + +================================================================================ +`; + +exports[`snippet: S4T7.yaml - Document with footer format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +aaa: bbb +... + +=====================================output===================================== +aaa: bbb +... + +================================================================================ +`; + +exports[`snippet: S7BG.yaml - Colon followed by comma format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +- :, + +=====================================output===================================== +--- +- :, + +================================================================================ +`; + +exports[`snippet: S9E8.yaml - Spec Example 5.3. Block Structure Indicators format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +sequence: +- one +- two +mapping: + ? sky + : blue + sea : green + +=====================================output===================================== +sequence: + - one + - two +mapping: + sky: blue + sea: green + +================================================================================ +`; + +exports[`snippet: SBG9.yaml - Flow Sequence in Flow Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{a: [b, c], [d, e]: f} + +=====================================output===================================== +{ a: [b, c], [d, e]: f } + +================================================================================ +`; + +exports[`snippet: SKE5.yaml - Anchor before zero indented sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +seq: + &anchor +- a +- b + +=====================================output===================================== +--- +seq: &anchor + - a + - b + +================================================================================ +`; + +exports[`snippet: SM9W.yaml - Single character streams format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- +=====================================output===================================== +- + +================================================================================ +`; + +exports[`snippet: SM9W-2.yaml - Single character streams(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +: +=====================================output===================================== +: + +================================================================================ +`; + +exports[`snippet: SSW6.yaml - Spec Example 7.7. Single Quoted Characters [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +'here''s to "quotes"' + +=====================================output===================================== +--- +'here''s to "quotes"' + +================================================================================ +`; + +exports[`snippet: SYW4.yaml - Spec Example 2.2. Mapping Scalars to Scalars format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +hr: 65 # Home runs +avg: 0.278 # Batting average +rbi: 147 # Runs Batted In + +=====================================output===================================== +hr: 65 # Home runs +avg: 0.278 # Batting average +rbi: 147 # Runs Batted In + +================================================================================ +`; + +exports[`snippet: T4YY.yaml - Spec Example 7.9. Single Quoted Lines [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +' 1st non-empty + + 2nd non-empty + 3rd non-empty ' + +=====================================output===================================== +--- +" 1st non-empty + +2nd non-empty +3rd non-empty " + +================================================================================ +`; + +exports[`snippet: T5N4.yaml - Spec Example 8.7. Literal Scalar [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- | + literal + text + + + +=====================================output===================================== +--- +| + literal + text + +================================================================================ +`; + +exports[`snippet: T26H.yaml - Spec Example 8.8. Literal Content [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- | + + + literal + + + text + + # Comment + +=====================================output===================================== +--- +| + + + literal + + + text + +# Comment + +================================================================================ +`; + +exports[`snippet: TE2A.yaml - Spec Example 8.16. Block Mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +block mapping: + key: value + +=====================================output===================================== +block mapping: + key: value + +================================================================================ +`; + +exports[`snippet: TL85.yaml - Spec Example 6.8. Flow Folding format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +" + foo + + bar + + baz +" + +=====================================output===================================== +" +foo + +bar + +baz +" + +================================================================================ +`; + +exports[`snippet: TS54.yaml - Folded Block Scalar format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +> + ab + cd + + ef + + + gh + +=====================================output===================================== +> + ab + cd + + ef + + + gh + +================================================================================ +`; + +exports[`snippet: U3C3.yaml - Spec Example 6.16. “TAG” directive format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%TAG !yaml! tag:yaml.org,2002: +--- +!yaml!str "foo" + +=====================================output===================================== +%TAG !yaml! tag:yaml.org,2002: +--- +!yaml!str "foo" + +================================================================================ +`; + +exports[`snippet: U3XV.yaml - Node and Mapping Key Anchors format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +top1: &node1 + &k1 key1: one +top2: &node2 # comment + key2: two +top3: + &k3 key3: three +top4: + &node4 + &k4 key4: four +top5: + &node5 + key5: five +top6: &val6 + six +top7: + &val7 seven + +=====================================output===================================== +--- +top1: &node1 + &k1 key1: one +top2: &node2 # comment + key2: two +top3: + &k3 key3: three +top4: &node4 + &k4 key4: four +top5: &node5 + key5: five +top6: &val6 six +top7: &val7 seven + +================================================================================ +`; + +exports[`snippet: U9NS.yaml - Spec Example 2.8. Play by Play Feed from a Game format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +time: 20:03:20 +player: Sammy Sosa +action: strike (miss) +... +--- +time: 20:03:47 +player: Sammy Sosa +action: grand slam +... + +=====================================output===================================== +--- +time: 20:03:20 +player: Sammy Sosa +action: strike (miss) +... +--- +time: 20:03:47 +player: Sammy Sosa +action: grand slam +... + +================================================================================ +`; + +exports[`snippet: UDM2.yaml - Plain URL in flow mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- { url: http://example.org } + +=====================================output===================================== +- { url: http://example.org } + +================================================================================ +`; + +exports[`snippet: UDR7.yaml - Spec Example 5.4. Flow Collection Indicators format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +sequence: [ one, two, ] +mapping: { sky: blue, sea: green } + +=====================================output===================================== +sequence: [one, two] +mapping: { sky: blue, sea: green } + +================================================================================ +`; + +exports[`snippet: UGM3.yaml - Spec Example 2.27. Invoice format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- ! +invoice: 34843 +date : 2001-01-23 +bill-to: &id001 + given : Chris + family : Dumars + address: + lines: | + 458 Walkman Dr. + Suite #292 + city : Royal Oak + state : MI + postal : 48046 +ship-to: *id001 +product: + - sku : BL394D + quantity : 4 + description : Basketball + price : 450.00 + - sku : BL4438H + quantity : 1 + description : Super Hoop + price : 2392.00 +tax : 251.42 +total: 4443.52 +comments: + Late afternoon is best. + Backup contact is Nancy + Billsmer @ 338-4338. + +=====================================output===================================== +--- +! +invoice: 34843 +date: 2001-01-23 +bill-to: &id001 + given: Chris + family: Dumars + address: + lines: | + 458 Walkman Dr. + Suite #292 + city: Royal Oak + state: MI + postal: 48046 +ship-to: *id001 +product: + - sku: BL394D + quantity: 4 + description: Basketball + price: 450.00 + - sku: BL4438H + quantity: 1 + description: Super Hoop + price: 2392.00 +tax: 251.42 +total: 4443.52 +comments: Late afternoon is best. + Backup contact is Nancy + Billsmer @ 338-4338. + +================================================================================ +`; + +exports[`snippet: UKK6.yaml - Syntax character edge cases format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- : + +=====================================output===================================== +- : + +================================================================================ +`; + +exports[`snippet: UKK6-2.yaml - Syntax character edge cases(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +:: + +=====================================output===================================== +:: + +================================================================================ +`; + +exports[`snippet: UKK6-3.yaml - Syntax character edge cases(3) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +! + +=====================================output===================================== +! + +================================================================================ +`; + +exports[`snippet: UT92.yaml - Spec Example 9.4. Explicit Documents format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +{ matches +% : 20 } +... +--- +# Empty +... + +=====================================output===================================== +--- +{ ? matches + % + : 20 } +... +--- +# Empty +... + +================================================================================ +`; + +exports[`snippet: UV7Q.yaml - Legal tab after indentation format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +x: + - x + x + +=====================================output===================================== +x: + - x + x + +================================================================================ +`; + +exports[`snippet: V9D5.yaml - Spec Example 8.19. Compact Block Mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- sun: yellow +- ? earth: blue + : moon: white + +=====================================output===================================== +- sun: yellow +- ? earth: blue + : moon: white + +================================================================================ +`; + +exports[`snippet: V55R.yaml - Aliases in Block Sequence format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- &a a +- &b b +- *a +- *b + +=====================================output===================================== +- &a a +- &b b +- *a +- *b + +================================================================================ +`; + +exports[`snippet: VJP3-2.yaml - Flow collections over many lines(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +k: { + k + : + v + } + +=====================================output===================================== +k: { k: v } + +================================================================================ +`; + +exports[`snippet: W4TN.yaml - Spec Example 9.5. Directives Documents format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%YAML 1.2 +--- | +%!PS-Adobe-2.0 +... +%YAML 1.2 +--- +# Empty +... + +=====================================output===================================== +%YAML 1.2 +--- +| + %!PS-Adobe-2.0 +... +%YAML 1.2 +--- +# Empty +... + +================================================================================ +`; + +exports[`snippet: W5VH.yaml - Allowed characters in alias format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: &:@*!$": scalar a +b: *:@*!$": + +=====================================output===================================== +a: &:@*!$": scalar a +b: *:@*!$": + +================================================================================ +`; + +exports[`snippet: W42U.yaml - Spec Example 8.15. Block Sequence Entry Types format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- # Empty +- | + block node +- - one # Compact + - two # sequence +- one: two # Compact mapping + +=====================================output===================================== +- # Empty +- | + block node +- - one # Compact + - two # sequence +- one: two # Compact mapping + +================================================================================ +`; + +exports[`snippet: WZ62.yaml - Spec Example 7.2. Empty Content format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ + foo : !!str, + !!str : bar, +} + +=====================================output===================================== +{ foo: !!str , !!str : bar } + +================================================================================ +`; + +exports[`snippet: X8DW.yaml - Explicit key and value seperated by comment format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +? key +# comment +: value + +=====================================output===================================== +--- +? key +# comment +: value + +================================================================================ +`; + +exports[`snippet: X38W.yaml - Aliases in Flow Objects format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ &a [a, &b b]: *b, *a : [c, *b, d]} + +=====================================output===================================== +{ &a [a, &b b]: *b, *a : [c, *b, d] } + +================================================================================ +`; + +exports[`snippet: XLQ9.yaml - Multiline scalar that looks like a YAML directive format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +scalar +%YAML 1.2 + +=====================================output===================================== +--- +scalar +%YAML 1.2 + +================================================================================ +`; + +exports[`snippet: XV9V.yaml - Spec Example 6.5. Empty Lines [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +Folding: + "Empty line + + as a line feed" +Chomping: | + Clipped empty lines + + + +=====================================output===================================== +Folding: "Empty line + + as a line feed" +Chomping: | + Clipped empty lines + +================================================================================ +`; + +exports[`snippet: XW4D.yaml - Various Trailing Comments format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +a: "double + quotes" # lala +b: plain + value # lala +c : #lala + d +? # lala + - seq1 +: # lala + - #lala + seq2 +e: + &node # lala + - x: y +block: > # lala + abcde + +=====================================output===================================== +a: "double + quotes" # lala +b: plain + value # lala +c: #lala + d +? # lala + - seq1 +: # lala + - #lala + seq2 +e: &node # lala + - x: y +block: > # lala + abcde + +================================================================================ +`; + +exports[`snippet: Y2GN.yaml - Anchor with colon in the middle format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +key: &an:chor value + +=====================================output===================================== +--- +key: &an:chor value + +================================================================================ +`; + +exports[`snippet: Y79Y-2.yaml - Tabs in various contexts(2) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo: | + +bar: 1 + +=====================================output===================================== +foo: | + +bar: 1 + +================================================================================ +`; + +exports[`snippet: Y79Y-11.yaml - Tabs in various contexts(11) format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- -1 + +=====================================output===================================== +- -1 + +================================================================================ +`; + +exports[`snippet: YD5X.yaml - Spec Example 2.5. Sequence of Sequences format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +- [name , hr, avg ] +- [Mark McGwire, 65, 0.278] +- [Sammy Sosa , 63, 0.288] + +=====================================output===================================== +- [name, hr, avg] +- [Mark McGwire, 65, 0.278] +- [Sammy Sosa, 63, 0.288] + +================================================================================ +`; + +exports[`snippet: Z9M4.yaml - Spec Example 6.22. Global Tag Prefix format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +%TAG !e! tag:example.com,2000:app/ +--- +- !e!foo "bar" + +=====================================output===================================== +%TAG !e! tag:example.com,2000:app/ +--- +- !e!foo "bar" + +================================================================================ +`; + +exports[`snippet: Z67P.yaml - Spec Example 8.21. Block Scalar Nodes [1.3] format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +literal: |2 + value +folded: !foo >1 + value + +=====================================output===================================== +literal: |2 + value +folded: !foo >1 + value + +================================================================================ +`; + +exports[`snippet: ZF4X.yaml - Spec Example 2.6. Mapping of Mappings format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +Mark McGwire: {hr: 65, avg: 0.278} +Sammy Sosa: { + hr: 63, + avg: 0.288 + } + +=====================================output===================================== +Mark McGwire: { hr: 65, avg: 0.278 } +Sammy Sosa: { hr: 63, avg: 0.288 } + +================================================================================ +`; + +exports[`snippet: ZH7C.yaml - Anchors in Mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +&a a: b +c: &d d + +=====================================output===================================== +&a a: b +c: &d d + +================================================================================ +`; + +exports[`snippet: ZK9H.yaml - Nested top level flow mapping format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +{ key: [[[ + value + ]]] +} + +=====================================output===================================== +{ key: [[[value]]] } + +================================================================================ +`; + +exports[`snippet: ZWK4.yaml - Key with anchor after missing explicit mapping value format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 + | printWidth +=====================================input====================================== +--- +a: 1 +? b +&anchor c: 3 + +=====================================output===================================== +--- +a: 1 +b: +&anchor c: 3 + +================================================================================ +`; diff --git a/tests/format/yaml/yaml-test-suite/format.test.js b/tests/format/yaml/yaml-test-suite/format.test.js new file mode 100644 index 000000000..e52970fdd --- /dev/null +++ b/tests/format/yaml/yaml-test-suite/format.test.js @@ -0,0 +1,64 @@ +import yamlTestSuite from "yaml-test-suite"; + +const FIXTURE_EXTENSION = ".yaml"; +const SKIP = new Set([ + // duplicate empty keys are invalid + // https://github.com/eemeli/yaml/blob/92821f2b8164f9831ff5a51f6e5a575e06365742/tests/yaml-test-suite.ts#L20 + // Map keys must be unique; "null" is repeated + // https://prettier.io/playground/#N4Igxg9gdgLgprEAuZACAhgHSk1AjbEAGhAgAcYBLaAZ2VHQCdGIB3ABSYTpXQBtW6AJ50SeRujABrODADK6ALZwAMpShxkAM3404JCHgBWcMDADqEsshBlGcPYwBumsROmy5ZSeoDmyGEYAV30QPUVKAODQuAAPMjhGSmVYfgB5BIkYCEZ2CBpKKmgbBAATYhA4zOSEGH4AFUSoJkoHbV1QgqhfPjgARSCIeHa+PRIjGli5P16Boc0kHVHQgEdB+HYWMh4QdBoAWg04UuOKwPRKPj8AYQhFRXQbfj4Krp64AEEYQMo8II3EmoNCMxiAABYwRR8cxgwoObxgOBybiFShOQpCGxgGiiEBOEIASSgJ1gcjASQoH2JchgQl6INCdnycEs6GsKDsDkSLgq6kcME26F8DwZJG8jEcNiESheYqSsHMlFKMDByAAHAAGEj2NaUeyC4WPRYdEh1PCK5WqpAAJhIQT09XQeB4S1BcEUeGOJ1KKnQ3SCQrgADEcg9vn4nv8ICAAL4xoA + "2JQS.yaml", + // Plain value cannot start with a tab character + // https://prettier.io/playground/#N4Igxg9gdgLgprEAuEAzCEkB0oAIswBGAhgE4gA0IEADjAJbQDOyoZpEA7gApkIspiAG07EAniyqFSxMAGs4MAMrEAtnAAy9KHGSphTOFQiEAVnDAwA6jJrIQNUnEOkAbrqkz5ipTVnaAc2QYUgBXIxBDVXpgsIi4AA8aOFJ6dVhhAHlkmRgIUm4IJnoGaHsEABNKEESctIQYYQAVFKgyemc9AwjiqAChOABFUIh4LqFDKlMmBKVAgeHR3SR9CYiARxH4bg4aARBiJgBaHTgKs+qQ4nohQIBhCFVVYnthIWre-rgAQRgQ+kIoW2KS0OnGkxAAAsYKohFZISVnH4wHAlPwSvRXCUxPYwExJCBXOEAJJQc6wJRgVJ0b5kpQwMQDcERRxFOA2Yh2FCOZwpdzVbQuGA7YgBZ7Mqh+UguexiNTvSWpWBWegVGCQ5AADgADFQnJt6E4RWKXitulRGoQVWqNUgAExUUKGJrEQgCVYQuCqQhnc4VDTEPqhUVwABi+Wef0CryBEBAAF940A + "DK95.yaml", + // Insufficient indentation in flow collection + // https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBaABAbQDpWzXdAMwgkIF1cQAaECABxgEtoBnZUAQwCduIB3AAo8E7FJwA2-TgE92tAEbdOYANZwYAZU4BbOABkmUOMiKTWcWhAUArOGBgB1ZfWQh63OBe4A3E4uU1DU16FSMAc2QYbgBXSxALHSYo2Pi4AA96OG4mPVhJAHks5RgIbkEIViZmaDcEABMaEAzi3IQYSQAVbKgeJi9Tc3iqqHCJOABFGIh4QYkLWhtWdM0I8amZkyQzefiAR2n4QT56MRBOVlRjOHqbpujOJgkIgGEIHR1ON0kJJpGxuAAQRg0SYChiR2yhmMcwWIAAFjAdBJHPDql5QmA4JpRNUmD5qjI3GBWPIQD44gBJKC3WCaMA5RiAmmaGAycaw+IeSpwZycVwoDxebJ+JpGbwwY6ccKfTm0ULcbxuGS6X7ynKwRxMeoweHIAAcAAZaJ4DkxPFKZV9tkNaB0FFqdXqkAAmWgxCydTgKMQ7OFwHQKG63er6TijGLSuAAMTKnxBEW+EIgIAAvqmgA + "Y79Y-3.yaml", +]); + +// https://github.com/prettier/prettier/issues/18302 +const BUGS = new Set([ + "DE56-3.yaml", + "DE56-4.yaml", + "JEF9-2.yaml", + "JEF9-3.yaml", + "K3WX.yaml", + "L24T-2.yaml", +]); + +runFormatTest( + { + importMeta: import.meta, + snippets: yamlTestSuite.flatMap(({ name, filename, cases }) => + cases + .map((testCase, index) => { + if (testCase.fail) { + return; + } + + const filenameToDisplay = + index === 0 + ? filename + : filename.slice(0, -FIXTURE_EXTENSION.length) + + `-${index + 1}` + + FIXTURE_EXTENSION; + + if (SKIP.has(filenameToDisplay) || BUGS.has(filenameToDisplay)) { + // console.log(testCase); + return; + } + + return { + name: + filenameToDisplay + + " - " + + name + + (index === 0 ? "" : `(${index + 1})`), + filename: filenameToDisplay, + code: testCase.yaml, + }; + }) + .filter(Boolean), + ), + }, + ["yaml"], +); diff --git a/yarn.lock b/yarn.lock index 509b4d8ef..87368ce53 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7590,6 +7590,7 @@ __metadata: vnopts: "npm:2.0.3" wcwidth.js: "npm:2.0.0" yaml: "npm:1.10.2" + yaml-test-suite: "npm:0.0.2" yaml-unist-parser: "npm:2.1.1" bin: prettier: ./bin/prettier.cjs @@ -9220,6 +9221,13 @@ __metadata: languageName: node linkType: hard +"yaml-test-suite@npm:0.0.2": + version: 0.0.2 + resolution: "yaml-test-suite@npm:0.0.2" + checksum: 10/d0c5b2610f78deae40dcbb1d4adb5024190d3cd36e5423d1e554d894087919a6e991ee26bce88717864d64c80764fa4d2964b936b0f7e92c0820da1d75790854 + languageName: node + linkType: hard + "yaml-unist-parser@npm:2.1.1": version: 2.1.1 resolution: "yaml-unist-parser@npm:2.1.1"