diff --git a/README.md b/README.md index 4c38308629..1fff0a730b 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ prettierx - `--no-object-curly-spacing` (`objectCurlySpacing: false`): Disable spaces between object curly braces (similar to the corresponding eslint option). - `--no-graphql-curly-spacing` (`graphqlCurlySpacing: false`): Disable spaces between curly braces for GraphQL. - `--no-yaml-bracket-spacing` (`yamlBracketSpacing: false`): Disable spaces between brackets / curly braces for YAML. +- `--no-yaml-break-before-comment` (`yamlBreakBeforeComment: false`): Put or remove line break before comment section. - `--no-type-curly-spacing` (`typeCurlySpacing: false`): Disable spaces between type curly braces. (See [`docs/options.md`](docs/options.md) for more information.) diff --git a/docs/options.md b/docs/options.md index d2beddef47..f7b46d25f2 100644 --- a/docs/options.md +++ b/docs/options.md @@ -391,6 +391,14 @@ Put or disable spaces between brackets / curly braces for YAML. | ------- | --------------------------- | ---------------------------- | | `true` | `--no-yaml-bracket-spacing` | `yamlBracketSpacing: ` | +## YAML line break before comment + +Put or remove line breaked before comment section for YAML. + +| Default | CLI Override | API Override | +| ------- | --------------------------- | ---------------------------- | +| `false` | `--no-yaml-break-before-comment` | `yamlBreakBeforeComment: ` | + ## Type curly spacing Put or disable spaces between type curly braces. diff --git a/src/language-yaml/options.js b/src/language-yaml/options.js index 0e3453dc19..479aa13922 100644 --- a/src/language-yaml/options.js +++ b/src/language-yaml/options.js @@ -15,4 +15,12 @@ module.exports = { oppositeDescription: "Do not put spaces between brackets / curly braces for YAML.", }, + yamlBreakBeforeComment: { + category: "Other", + type: "boolean", + default: false, + description: "Put or remove line breaked before comment section for YAML.", + oppositeDescription: + "Do not put line break before comment section for YAML.", + }, }; diff --git a/src/language-yaml/printer-yaml.js b/src/language-yaml/printer-yaml.js index b358a449f6..31e54d9a09 100644 --- a/src/language-yaml/printer-yaml.js +++ b/src/language-yaml/printer-yaml.js @@ -43,6 +43,7 @@ const { } = require("./print/flow-mapping-sequence"); const printMappingItem = require("./print/mapping-item"); const printBlock = require("./print/block"); +const { yamlBreakBeforeComment } = require("./options"); function genericPrint(path, options, print) { const node = path.getValue(); @@ -91,7 +92,7 @@ function genericPrint(path, options, print) { if (hasMiddleComments(node)) { parts.push([ - node.middleComments.length === 1 ? "" : hardline, + node.middleComments.length === 1 && !yamlBreakBeforeComment ? "" : hardline, join(hardline, path.map(print, "middleComments")), hardline, ]); diff --git a/tests/format/yaml/block-folded/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/block-folded/__snapshots__/jsfmt.spec.js.snap index 6f93ba6f7d..5e2b69849d 100644 --- a/tests/format/yaml/block-folded/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/block-folded/__snapshots__/jsfmt.spec.js.snap @@ -224,7 +224,8 @@ proseWrap: "always" 123 =====================================output===================================== -!!str #comment +!!str +#comment > 123 @@ -242,7 +243,8 @@ printWidth: 80 123 =====================================output===================================== -!!str #comment +!!str +#comment > 123 diff --git a/tests/format/yaml/block-literal/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/block-literal/__snapshots__/jsfmt.spec.js.snap index 24268e272c..1749c01259 100644 --- a/tests/format/yaml/block-literal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/block-literal/__snapshots__/jsfmt.spec.js.snap @@ -14,6 +14,29 @@ proseWrap: "always" +=====================================output===================================== +| + 123 + 456 + 789 + +================================================================================ +`; + +exports[`clip.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +| + 123 + 456 + 789 + + + =====================================output===================================== | 123 @@ -59,6 +82,29 @@ proseWrap: "always" +=====================================output===================================== +|2- + 123 + 456 + 789 + +================================================================================ +`; + +exports[`indent.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +|2- + 123 + 456 + 789 + + + =====================================output===================================== |2- 123 @@ -112,6 +158,31 @@ proseWrap: "always" +================================================================================ +`; + +exports[`keep.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +|+ + 123 + 456 + 789 + + + +=====================================output===================================== +|+ + 123 + 456 + 789 + + + ================================================================================ `; @@ -180,6 +251,47 @@ c: 0 ================================================================================ `; +exports[`map.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: | + 123 + 456 + 789 +b: |1 + 123 + 456 + 789 +d: | + 123 + 456 + 789 + +c: 0 + +=====================================output===================================== +a: | + 123 + 456 + 789 +b: |1 + 123 + 456 + 789 +d: | + 123 + 456 + 789 + +c: 0 + +================================================================================ +`; + exports[`map.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -232,10 +344,31 @@ proseWrap: "always" 123 =====================================output===================================== +!!str +#comment +| + 123 + +================================================================================ +`; + +exports[`middle-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== !!str #comment | 123 +=====================================output===================================== +!!str +#comment +| + 123 + ================================================================================ `; @@ -250,7 +383,8 @@ printWidth: 80 123 =====================================output===================================== -!!str #comment +!!str +#comment | 123 @@ -279,6 +413,28 @@ proseWrap: "always" ================================================================================ `; +exports[`middle-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!str # comment 1 +# comment 2 +| + 123 + +=====================================output===================================== +!!str +# comment 1 +# comment 2 +| + 123 + +================================================================================ +`; + exports[`middle-comments.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -324,6 +480,35 @@ proseWrap: "always" +- 0 + +================================================================================ +`; + +exports[`newline.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- |+ + 123 + 456 + 789 + + + +- 0 + +=====================================output===================================== +- |+ + 123 + 456 + 789 + + + - 0 ================================================================================ @@ -432,6 +617,81 @@ proseWrap: "always" ================================================================================ `; +exports[`newline-unaligned.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +| + 1 + 2 + 3 + 4 + 5 + 6 + + 1 + 2 + 3 + 4 + 5 + 6 + + + 1 + 2 + 3 + 4 + 5 + 6 + + 1 + 2 + + 3 + 4 + + 5 + 6 + +=====================================output===================================== +| + 1 + 2 + 3 + 4 + 5 + 6 + + 1 + 2 + 3 + 4 + 5 + 6 + + + 1 + 2 + 3 + 4 + 5 + 6 + + 1 + 2 + + 3 + 4 + + 5 + 6 + +================================================================================ +`; + exports[`newline-unaligned.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -523,6 +783,23 @@ proseWrap: "always" ================================================================================ `; +exports[`props.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!str &anchor | + 123 + +=====================================output===================================== +!!str &anchor | + 123 + +================================================================================ +`; + exports[`props.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -556,6 +833,23 @@ a: !!str &anchor | ================================================================================ `; +exports[`props-in-map.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: !!str &anchor | + 123 + +=====================================output===================================== +a: !!str &anchor | + 123 + +================================================================================ +`; + exports[`props-in-map.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -603,6 +897,37 @@ proseWrap: "always" ================================================================================ `; +exports[`seq.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- | + 123 + 456 + 789 +- |1 + 123 + 456 + 789 +- 0 + +=====================================output===================================== +- | + 123 + 456 + 789 +- |1 + 123 + 456 + 789 +- 0 + +================================================================================ +`; + exports[`seq.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -647,6 +972,29 @@ proseWrap: "always" +=====================================output===================================== +|- + 123 + 456 + 789 + +================================================================================ +`; + +exports[`strip.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +|- + 123 + 456 + 789 + + + =====================================output===================================== |- 123 @@ -695,6 +1043,23 @@ a: !!str | # hello ================================================================================ `; +exports[`trailing-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: !!str | # hello + hello + +=====================================output===================================== +a: !!str | # hello + hello + +================================================================================ +`; + exports[`trailing-comment.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] diff --git a/tests/format/yaml/block-literal/jsfmt.spec.js b/tests/format/yaml/block-literal/jsfmt.spec.js index bedc8dbb95..5342c2d106 100644 --- a/tests/format/yaml/block-literal/jsfmt.spec.js +++ b/tests/format/yaml/block-literal/jsfmt.spec.js @@ -1,2 +1,4 @@ run_spec(__dirname, ["yaml"]); run_spec(__dirname, ["yaml"], { proseWrap: "always" }); +// support --no-yaml-break-before-comment +run_spec(__dirname, ["yaml"], { yamlBreakBeforeComment: false }); diff --git a/tests/format/yaml/flow-mapping/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/flow-mapping/__snapshots__/jsfmt.spec.js.snap index e1a93b79f2..baecbd2b7f 100644 --- a/tests/format/yaml/flow-mapping/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/flow-mapping/__snapshots__/jsfmt.spec.js.snap @@ -31,6 +31,21 @@ tabWidth: 4 ================================================================================ `; +exports[`alias-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{&123 foo, *123 : 456} + +=====================================output===================================== +{ &123 foo, *123 : 456 } + +================================================================================ +`; + exports[`alias-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -108,6 +123,37 @@ tabWidth: 4 ================================================================================ `; +exports[`array-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{? [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],? [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],? [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]} + +=====================================output===================================== +{ + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], +} + +================================================================================ +`; + exports[`array-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -231,6 +277,52 @@ tabWidth: 4 ================================================================================ `; +exports[`array-key-array-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]} + +=====================================output===================================== +{ + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ] + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ] + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ] + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], +} + +================================================================================ +`; + exports[`array-key-array-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -339,6 +431,37 @@ tabWidth: 4 ================================================================================ `; +exports[`array-plain.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]} + +=====================================output===================================== +{ + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], +} + +================================================================================ +`; + exports[`array-plain.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -438,6 +561,40 @@ tabWidth: 4 ================================================================================ `; +exports[`array-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{a: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],b: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],c: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]} + +=====================================output===================================== +{ + a: + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + b: + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + c: + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], +} + +================================================================================ +`; + exports[`array-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -518,6 +675,29 @@ tabWidth: 4 ================================================================================ `; +exports[`comment-between.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ +? 123 +# comment +: 456 +} + +=====================================output===================================== +{ + ? 123 + # comment + : 456, +} + +================================================================================ +`; + exports[`comment-between.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -577,6 +757,24 @@ tabWidth: 4 ================================================================================ `; +exports[`comment-trailing.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{123, # comment +} + +=====================================output===================================== +{ + 123, # comment +} + +================================================================================ +`; + exports[`comment-trailing.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -625,6 +823,21 @@ tabWidth: 4 ================================================================================ `; +exports[`empty.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{} + +=====================================output===================================== +{} + +================================================================================ +`; + exports[`empty.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -670,6 +883,21 @@ tabWidth: 4 ================================================================================ `; +exports[`empty-item-colon.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ : } + +=====================================output===================================== +{ : } + +================================================================================ +`; + exports[`empty-item-colon.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -727,6 +955,27 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb } ================================================================================ `; +exports[`empty-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb } + +=====================================output===================================== +{ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, +} + +================================================================================ +`; + exports[`empty-line.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -782,6 +1031,23 @@ bbb } ================================================================================ `; +exports[`empty-line-collapse.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ aaa, + +bbb } + +=====================================output===================================== +{ aaa, bbb } + +================================================================================ +`; + exports[`empty-line-collapse.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -837,6 +1103,25 @@ tabWidth: 4 ================================================================================ `; +exports[`long-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong1,? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong2,? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong3} + +=====================================output===================================== +{ + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong1, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong2, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong3, +} + +================================================================================ +`; + exports[`long-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -894,6 +1179,25 @@ tabWidth: 4 ================================================================================ `; +exports[`long-key-long-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong1: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong2: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong3: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong} + +=====================================output===================================== +{ + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong1: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong2: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong3: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, +} + +================================================================================ +`; + exports[`long-key-long-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -951,6 +1255,25 @@ tabWidth: 4 ================================================================================ `; +exports[`long-plain.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong1,longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong2,longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong3} + +=====================================output===================================== +{ + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong1, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong2, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong3, +} + +================================================================================ +`; + exports[`long-plain.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1008,6 +1331,25 @@ tabWidth: 4 ================================================================================ `; +exports[`long-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{1: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,2: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,3: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong} + +=====================================output===================================== +{ + 1: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + 2: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + 3: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, +} + +================================================================================ +`; + exports[`long-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1038,7 +1380,8 @@ yamlBracketSpacing: false {} =====================================output===================================== -!!map #comment +!!map +#comment {} ================================================================================ @@ -1055,9 +1398,28 @@ tabWidth: 4 {} =====================================output===================================== +!!map +#comment +{} + +================================================================================ +`; + +exports[`middle-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== !!map #comment {} +=====================================output===================================== +!!map +#comment +{} + ================================================================================ `; @@ -1071,7 +1433,8 @@ printWidth: 80 {} =====================================output===================================== -!!map #comment +!!map +#comment {} ================================================================================ @@ -1118,6 +1481,26 @@ tabWidth: 4 ================================================================================ `; +exports[`middle-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!map # comment 1 +# comment 2 +{} + +=====================================output===================================== +!!map +# comment 1 +# comment 2 +{} + +================================================================================ +`; + exports[`middle-comments.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1186,6 +1569,30 @@ c: 123 ================================================================================ `; +exports[`next-empty-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: 123, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: 123, + +c: 123 +} + +=====================================output===================================== +{ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: 123, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: 123, + + c: 123, +} + +================================================================================ +`; + exports[`next-empty-line.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1240,6 +1647,21 @@ tabWidth: 4 ================================================================================ `; +exports[`props.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!map &anchor {a: 1} + +=====================================output===================================== +!!map &anchor { a: 1 } + +================================================================================ +`; + exports[`props.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1285,6 +1707,21 @@ a: !!map &anchor { a: 1 } ================================================================================ `; +exports[`props-in-map.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: !!map &anchor {a: 1} + +=====================================output===================================== +a: !!map &anchor { a: 1 } + +================================================================================ +`; + exports[`props-in-map.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1330,6 +1767,21 @@ tabWidth: 4 ================================================================================ `; +exports[`short-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{? 1,? 2,? 3} + +=====================================output===================================== +{ 1, 2, 3 } + +================================================================================ +`; + exports[`short-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1375,6 +1827,21 @@ tabWidth: 4 ================================================================================ `; +exports[`short-key-short-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{1: a,2: b,3: c} + +=====================================output===================================== +{ 1: a, 2: b, 3: c } + +================================================================================ +`; + exports[`short-key-short-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1420,6 +1887,21 @@ tabWidth: 4 ================================================================================ `; +exports[`short-plain.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{1,2,3} + +=====================================output===================================== +{ 1, 2, 3 } + +================================================================================ +`; + exports[`short-plain.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1465,6 +1947,21 @@ tabWidth: 4 ================================================================================ `; +exports[`short-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{1: 1,2: 2,3: 3} + +=====================================output===================================== +{ 1: 1, 2: 2, 3: 3 } + +================================================================================ +`; + exports[`short-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1518,6 +2015,25 @@ x: 12345678901234567890123456789012345678901234567890123456789012345678901234567 ================================================================================ `; +exports[`very-long-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ +x: 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 +} + +=====================================output===================================== +{ + x: 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890, +} + +================================================================================ +`; + exports[`very-long-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] diff --git a/tests/format/yaml/flow-mapping/jsfmt.spec.js b/tests/format/yaml/flow-mapping/jsfmt.spec.js index ae710d80c3..d749582eb3 100644 --- a/tests/format/yaml/flow-mapping/jsfmt.spec.js +++ b/tests/format/yaml/flow-mapping/jsfmt.spec.js @@ -3,3 +3,5 @@ run_spec(__dirname, ["yaml"], { tabWidth: 4 }); // [prettierx] support --no-yaml-bracket-spacing option // with bogus option to improve consistency of snapshot with Prettier 2.3.2 run_spec(__dirname, ["yaml"], { bogus: null, yamlBracketSpacing: false }); +// support --no-yaml-break-before-comment +run_spec(__dirname, ["yaml"], { yamlBreakBeforeComment: false }); diff --git a/tests/format/yaml/flow-sequence/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/flow-sequence/__snapshots__/jsfmt.spec.js.snap index 8dac907078..ba4c7c6db2 100644 --- a/tests/format/yaml/flow-sequence/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/flow-sequence/__snapshots__/jsfmt.spec.js.snap @@ -30,6 +30,21 @@ tabWidth: 4 ================================================================================ `; +exports[`alias-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[&123 foo, *123 : 456] + +=====================================output===================================== +[&123 foo, *123 : 456] + +================================================================================ +`; + exports[`alias-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -106,6 +121,37 @@ tabWidth: 4 ================================================================================ `; +exports[`array-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[? [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],? [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],? [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]] + +=====================================output===================================== +[ + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], +] + +================================================================================ +`; + exports[`array-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -228,6 +274,52 @@ tabWidth: 4 ================================================================================ `; +exports[`array-key-array-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]] + +=====================================output===================================== +[ + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ] + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ] + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + ? [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ] + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], +] + +================================================================================ +`; + exports[`array-key-array-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -335,6 +427,37 @@ tabWidth: 4 ================================================================================ `; +exports[`array-plain.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],[longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]] + +=====================================output===================================== +[ + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], +] + +================================================================================ +`; + exports[`array-plain.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -427,6 +550,37 @@ tabWidth: 4 ================================================================================ `; +exports[`array-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong],: [longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong, longlonglonglonglonglonglonglonglonglonglong]] + +=====================================output===================================== +[ + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], + : [ + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglong, + ], +] + +================================================================================ +`; + exports[`array-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -503,6 +657,29 @@ tabWidth: 4 ================================================================================ `; +exports[`comment-between.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ +? 123 +# comment +: 456 +] + +=====================================output===================================== +[ + ? 123 + # comment + : 456, +] + +================================================================================ +`; + exports[`comment-between.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -561,6 +738,24 @@ tabWidth: 4 ================================================================================ `; +exports[`comment-trailing.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[123, # comment +] + +=====================================output===================================== +[ + 123, # comment +] + +================================================================================ +`; + exports[`comment-trailing.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -608,6 +803,21 @@ tabWidth: 4 ================================================================================ `; +exports[`empty.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[] + +=====================================output===================================== +[] + +================================================================================ +`; + exports[`empty.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -652,6 +862,21 @@ tabWidth: 4 ================================================================================ `; +exports[`empty-item-colon.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ : ] + +=====================================output===================================== +[: ] + +================================================================================ +`; + exports[`empty-item-colon.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -708,6 +933,27 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ] ================================================================================ `; +exports[`empty-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ] + +=====================================output===================================== +[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, +] + +================================================================================ +`; + exports[`empty-line.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -762,6 +1008,23 @@ bbb ] ================================================================================ `; +exports[`empty-line-collapse.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ aaa, + +bbb ] + +=====================================output===================================== +[aaa, bbb] + +================================================================================ +`; + exports[`empty-line-collapse.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -816,6 +1079,25 @@ tabWidth: 4 ================================================================================ `; +exports[`long-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong] + +=====================================output===================================== +[ + ? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + ? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + ? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, +] + +================================================================================ +`; + exports[`long-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -872,6 +1154,25 @@ tabWidth: 4 ================================================================================ `; +exports[`long-key-long-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong] + +=====================================output===================================== +[ + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, +] + +================================================================================ +`; + exports[`long-key-long-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -928,6 +1229,25 @@ tabWidth: 4 ================================================================================ `; +exports[`long-plain.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong] + +=====================================output===================================== +[ + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, +] + +================================================================================ +`; + exports[`long-plain.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -984,6 +1304,25 @@ tabWidth: 4 ================================================================================ `; +exports[`long-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong,: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong] + +=====================================output===================================== +[ + : longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + : longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, + : longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong, +] + +================================================================================ +`; + exports[`long-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1013,7 +1352,8 @@ printWidth: 80 [] =====================================output===================================== -!!set # comment +!!set +# comment [] ================================================================================ @@ -1030,9 +1370,28 @@ tabWidth: 4 [] =====================================output===================================== +!!set +# comment +[] + +================================================================================ +`; + +exports[`middle-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== !!set # comment [] +=====================================output===================================== +!!set +# comment +[] + ================================================================================ `; @@ -1046,7 +1405,8 @@ printWidth: 80 [] =====================================output===================================== -!!set # comment +!!set +# comment [] ================================================================================ @@ -1092,6 +1452,26 @@ tabWidth: 4 ================================================================================ `; +exports[`middle-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!set # comment 1 +# comment 2 +[] + +=====================================output===================================== +!!set +# comment 1 +# comment 2 +[] + +================================================================================ +`; + exports[`middle-comments.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1159,6 +1539,30 @@ c: 123 ================================================================================ `; +exports[`next-empty-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: 123, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: 123, + +c: 123 +] + +=====================================output===================================== +[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: 123, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: 123, + + c: 123, +] + +================================================================================ +`; + exports[`next-empty-line.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1212,6 +1616,21 @@ tabWidth: 4 ================================================================================ `; +exports[`props.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!set &anchor [1] + +=====================================output===================================== +!!set &anchor [1] + +================================================================================ +`; + exports[`props.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1256,6 +1675,21 @@ a: !!set &anchor [1] ================================================================================ `; +exports[`props-in-map.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: !!set &anchor [1] + +=====================================output===================================== +a: !!set &anchor [1] + +================================================================================ +`; + exports[`props-in-map.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1300,6 +1734,21 @@ tabWidth: 4 ================================================================================ `; +exports[`short-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[? 1,? 2,? 3] + +=====================================output===================================== +[? 1, ? 2, ? 3] + +================================================================================ +`; + exports[`short-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1344,6 +1793,21 @@ tabWidth: 4 ================================================================================ `; +exports[`short-key-short-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[1: a,2: b,3: c] + +=====================================output===================================== +[1: a, 2: b, 3: c] + +================================================================================ +`; + exports[`short-key-short-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1388,6 +1852,21 @@ tabWidth: 4 ================================================================================ `; +exports[`short-plain.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[1,2,3] + +=====================================output===================================== +[1, 2, 3] + +================================================================================ +`; + exports[`short-plain.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1432,6 +1911,21 @@ tabWidth: 4 ================================================================================ `; +exports[`short-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[: 1,: 2,: 3] + +=====================================output===================================== +[: 1, : 2, : 3] + +================================================================================ +`; + exports[`short-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] diff --git a/tests/format/yaml/flow-sequence/jsfmt.spec.js b/tests/format/yaml/flow-sequence/jsfmt.spec.js index 755b6ecb28..a58f785568 100644 --- a/tests/format/yaml/flow-sequence/jsfmt.spec.js +++ b/tests/format/yaml/flow-sequence/jsfmt.spec.js @@ -1,3 +1,5 @@ run_spec(__dirname, ["yaml"]); run_spec(__dirname, ["yaml"], { tabWidth: 4 }); run_spec(__dirname, ["yaml"], { bracketSpacing: false }); +// support --no-yaml-break-before-comment +run_spec(__dirname, ["yaml"], { yamlBreakBeforeComment: false }); diff --git a/tests/format/yaml/mapping/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/mapping/__snapshots__/jsfmt.spec.js.snap index ffb14a8ab9..5aec0104ea 100644 --- a/tests/format/yaml/mapping/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/mapping/__snapshots__/jsfmt.spec.js.snap @@ -27,6 +27,33 @@ tabWidth: 4 ================================================================================ `; +exports[`3-style.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +=====================================output===================================== +[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +? [ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + ] +: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +================================================================================ +`; + exports[`3-style.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -77,6 +104,30 @@ key2: ================================================================================ `; +exports[`anchor.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key1: &default + + subkey1: value1 + +key2: + <<: *default + +=====================================output===================================== +key1: &default + subkey1: value1 + +key2: + <<: *default + +================================================================================ +`; + exports[`anchor.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -116,7 +167,8 @@ key2: <<: *default =====================================output===================================== -key1: &default # This key ... +key1: &default + # This key ... subkey1: value1 key2: @@ -125,6 +177,32 @@ key2: ================================================================================ `; +exports[`anchor2.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key1: &default + + # This key ... + subkey1: value1 + +key2: + <<: *default + +=====================================output===================================== +key1: &default + # This key ... + subkey1: value1 + +key2: + <<: *default + +================================================================================ +`; + exports[`anchor2.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -140,7 +218,8 @@ key2: <<: *default =====================================output===================================== -key1: &default # This key ... +key1: &default + # This key ... subkey1: value1 key2: @@ -164,7 +243,8 @@ key2: <<: *default =====================================output===================================== -key1: &default # This key +key1: &default + # This key subkey1: value1 key2: @@ -173,6 +253,31 @@ key2: ================================================================================ `; +exports[`anchor3.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key1: &default +# This key + subkey1: value1 + +key2: + <<: *default + +=====================================output===================================== +key1: &default + # This key + subkey1: value1 + +key2: + <<: *default + +================================================================================ +`; + exports[`anchor3.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -187,7 +292,8 @@ key2: <<: *default =====================================output===================================== -key1: &default # This key +key1: &default + # This key subkey1: value1 key2: @@ -211,6 +317,21 @@ tabWidth: 4 ================================================================================ `; +exports[`array-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[1, 2, 3]: 123 + +=====================================output===================================== +[1, 2, 3]: 123 + +================================================================================ +`; + exports[`array-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -240,6 +361,21 @@ tabWidth: 4 ================================================================================ `; +exports[`array-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +123: [1, 2, 3] + +=====================================output===================================== +123: [1, 2, 3] + +================================================================================ +`; + exports[`array-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -273,6 +409,25 @@ tabWidth: 4 ================================================================================ `; +exports[`comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? key +# comment +: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +=====================================output===================================== +? key +# comment +: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +================================================================================ +`; + exports[`comment.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -306,6 +461,21 @@ tabWidth: 4 ================================================================================ `; +exports[`comment-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +123: # hello + +=====================================output===================================== +123: # hello + +================================================================================ +`; + exports[`comment-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -337,6 +507,23 @@ key2: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglo ================================================================================ `; +exports[`common.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key1: value +key2: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +=====================================output===================================== +key1: value +key2: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +================================================================================ +`; + exports[`common.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -389,6 +576,42 @@ solongitshouldbreakbutitcannot_longlonglonglonglonglonglonglonglonglonglonglongl ================================================================================ `; +exports[`explicit-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? key1 +: value +? key2 +: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong +? longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong +: value +? solongitshouldbreakbutitcannot_longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong +: # Comment + foo: bar +? multiline + scalar + key +: value + +=====================================output===================================== +key1: value +key2: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong +longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: value +solongitshouldbreakbutitcannot_longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: + # Comment + foo: bar +? multiline + scalar + key +: value + +================================================================================ +`; + exports[`explicit-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -441,6 +664,23 @@ tabWidth: 4 ================================================================================ `; +exports[`in-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- a: b + c: d + +=====================================output===================================== +- a: b + c: d + +================================================================================ +`; + exports[`in-sequence.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -476,6 +716,25 @@ tabWidth: 4 ================================================================================ `; +exports[`key-with-leading-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? # comment + key +: value + +=====================================output===================================== +? # comment + key +: value + +================================================================================ +`; + exports[`key-with-leading-comment.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -511,6 +770,23 @@ key: ================================================================================ `; +exports[`mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key: + key: value + +=====================================output===================================== +key: + key: value + +================================================================================ +`; + exports[`mapping.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -560,6 +836,39 @@ foo: ================================================================================ `; +exports[`merge-twice.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +.anchors: + - &anchor1 + key: value + - &anchor2 + another: prop + +foo: + bar: baz + <<: *anchor1 + <<: *anchor2 + +=====================================output===================================== +.anchors: + - &anchor1 + key: value + - &anchor2 + another: prop + +foo: + bar: baz + <<: *anchor1 + <<: *anchor2 + +================================================================================ +`; + exports[`merge-twice.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -603,9 +912,28 @@ tabWidth: 4 a: 123 =====================================output===================================== +!!map +# comment +a: 123 + +================================================================================ +`; + +exports[`middle-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== !!map # comment a: 123 +=====================================output===================================== +!!map +# comment +a: 123 + ================================================================================ `; @@ -619,7 +947,8 @@ printWidth: 80 a: 123 =====================================output===================================== -!!map # comment +!!map +# comment a: 123 ================================================================================ @@ -645,6 +974,26 @@ a: 123 ================================================================================ `; +exports[`middle-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!map # comment 1 +# comment 2 +a: 123 + +=====================================output===================================== +!!map +# comment 1 +# comment 2 +a: 123 + +================================================================================ +`; + exports[`middle-comments.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -682,6 +1031,24 @@ a: 123 ================================================================================ `; +exports[`props.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- !!map &anchor +a: 123 + +=====================================output===================================== +--- +!!map &anchor +a: 123 + +================================================================================ +`; + exports[`props.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -716,6 +1083,23 @@ a: !!map &anchor ================================================================================ `; +exports[`props-in-map.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: !!map &anchor + a: 123 + +=====================================output===================================== +a: !!map &anchor + a: 123 + +================================================================================ +`; + exports[`props-in-map.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -749,6 +1133,23 @@ tabWidth: 4 ================================================================================ `; +exports[`quote-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +"a": 123 +'b': 123 + +=====================================output===================================== +"a": 123 +"b": 123 + +================================================================================ +`; + exports[`quote-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -782,6 +1183,23 @@ key: ================================================================================ `; +exports[`sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key: +- value + +=====================================output===================================== +key: + - value + +================================================================================ +`; + exports[`sequence.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -814,6 +1232,22 @@ tabWidth: 4 ================================================================================ `; +exports[`tag-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? !!tag key +: value + +=====================================output===================================== +!!tag key: value + +================================================================================ +`; + exports[`tag-key.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] diff --git a/tests/format/yaml/mapping/jsfmt.spec.js b/tests/format/yaml/mapping/jsfmt.spec.js index 6fbe16994e..34206c0b8e 100644 --- a/tests/format/yaml/mapping/jsfmt.spec.js +++ b/tests/format/yaml/mapping/jsfmt.spec.js @@ -1,2 +1,4 @@ run_spec(__dirname, ["yaml"]); run_spec(__dirname, ["yaml"], { tabWidth: 4 }); +// support --no-yaml-break-before-comment +run_spec(__dirname, ["yaml"], { yamlBreakBeforeComment: false }); diff --git a/tests/format/yaml/plain/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/plain/__snapshots__/jsfmt.spec.js.snap index 77ef19c076..21cd92903b 100644 --- a/tests/format/yaml/plain/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/plain/__snapshots__/jsfmt.spec.js.snap @@ -68,6 +68,39 @@ newline: longlonglonglonglonglonglonglonglonglonglong ================================================================================ `; +exports[`force-singleline-in-mapping-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +no-whitesapce: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +whitespace: longlonglonglonglonglonglonglonglonglonglong longlonglonglonglonglonglonglonglonglonglong + +literal-newline: longlonglonglonglonglonglonglonglonglonglong + longlonglonglonglonglonglonglonglonglonglong + +newline: longlonglonglonglonglonglonglonglonglonglong + + longlonglonglonglonglonglonglonglonglonglong + +=====================================output===================================== +no-whitesapce: longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +whitespace: longlonglonglonglonglonglonglonglonglonglong longlonglonglonglonglonglonglonglonglonglong + +literal-newline: longlonglonglonglonglonglonglonglonglonglong + longlonglonglonglonglonglonglonglonglonglong + +newline: longlonglonglonglonglonglonglonglonglonglong + + longlonglonglonglonglonglonglonglonglonglong + +================================================================================ +`; + exports[`force-singleline-in-mapping-value.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -111,7 +144,8 @@ proseWrap: "always" hello =====================================output===================================== -!!str # comment +!!str +# comment hello ================================================================================ @@ -128,9 +162,28 @@ proseWrap: "never" hello =====================================output===================================== +!!str +# comment +hello + +================================================================================ +`; + +exports[`middle-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== !!str # comment hello +=====================================output===================================== +!!str +# comment +hello + ================================================================================ `; @@ -144,7 +197,8 @@ printWidth: 80 hello =====================================output===================================== -!!str # comment +!!str +# comment hello ================================================================================ @@ -190,6 +244,26 @@ hello ================================================================================ `; +exports[`middle-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!str # comment 1 +# comment 2 +hello + +=====================================output===================================== +!!str +# comment 1 +# comment 2 +hello + +================================================================================ +`; + exports[`middle-comments.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -294,6 +368,55 @@ b: + 123123123123123123123123123 + +================================================================================ +`; + +exports[`multiline.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +b: + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + + 123123123123123123123123123 + + + 123123123123123123123123123 + + + + + 123123123123123123123123123 + + +=====================================output===================================== +b: 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + 123123123123123123123123123 + + 123123123123123123123123123 + + + 123123123123123123123123123 + + + + 123123123123123123123123123 ================================================================================ @@ -377,6 +500,21 @@ hello ================================================================================ `; +exports[`true.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +hello + +=====================================output===================================== +hello + +================================================================================ +`; + exports[`true.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -421,6 +559,21 @@ proseWrap: "never" ================================================================================ `; +exports[`verbatim.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +! hello + +=====================================output===================================== +! hello + +================================================================================ +`; + exports[`verbatim.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] diff --git a/tests/format/yaml/plain/jsfmt.spec.js b/tests/format/yaml/plain/jsfmt.spec.js index 6d2ad095f4..233f231175 100644 --- a/tests/format/yaml/plain/jsfmt.spec.js +++ b/tests/format/yaml/plain/jsfmt.spec.js @@ -1,3 +1,5 @@ run_spec(__dirname, ["yaml"]); run_spec(__dirname, ["yaml"], { proseWrap: "never" }); run_spec(__dirname, ["yaml"], { proseWrap: "always" }); +// support --no-yaml-break-before-comment +run_spec(__dirname, ["yaml"], { yamlBreakBeforeComment: false }); diff --git a/tests/format/yaml/prettier-ignore/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/prettier-ignore/__snapshots__/jsfmt.spec.js.snap index c668fbd2f7..1a18cab23c 100644 --- a/tests/format/yaml/prettier-ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/prettier-ignore/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,31 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`document.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +# prettier-ignore +--- +aaaaa: + bbbbb +... +aaaaa: + bbbbb + +=====================================output===================================== +# prettier-ignore +--- +aaaaa: + bbbbb +--- +aaaaa: bbbbb + +================================================================================ +`; + exports[`document.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -25,6 +51,25 @@ aaaaa: bbbbb ================================================================================ `; +exports[`leading-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +abc: 123 +# prettier-ignore +def: 456 + +=====================================output===================================== +abc: 123 +# prettier-ignore +def: 456 + +================================================================================ +`; + exports[`leading-comment.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -43,6 +88,30 @@ def: 456 ================================================================================ `; +exports[`middle-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +abc: !!str # hello + 123 +# prettier-ignore +def: !!str # hello + 456 + +=====================================output===================================== +abc: !!str + # hello + 123 +# prettier-ignore +def: !!str # hello + 456 + +================================================================================ +`; + exports[`middle-comment.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -56,7 +125,8 @@ def: !!str # hello 456 =====================================output===================================== -abc: !!str # hello +abc: !!str + # hello 123 # prettier-ignore def: !!str # hello @@ -65,6 +135,37 @@ def: !!str # hello ================================================================================ `; +exports[`trailing-comma.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ + # prettier-ignore + { sss }, # 123 + { qqqq }, + + # prettier-ignore + [ccc ] # 777 + , [ddd ] +] + +=====================================output===================================== +[ + # prettier-ignore + { sss }, # 123 + { qqqq }, + + # prettier-ignore + [ccc ], # 777 + [ddd], +] + +================================================================================ +`; + exports[`trailing-comma.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -95,6 +196,25 @@ printWidth: 80 ================================================================================ `; +exports[`trailing-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +abc: 123 # hello +# prettier-ignore +def: 456 # hello + +=====================================output===================================== +abc: 123 # hello +# prettier-ignore +def: 456 # hello + +================================================================================ +`; + exports[`trailing-comment.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] diff --git a/tests/format/yaml/prettier-ignore/jsfmt.spec.js b/tests/format/yaml/prettier-ignore/jsfmt.spec.js index 89d18c0073..311b73e36c 100644 --- a/tests/format/yaml/prettier-ignore/jsfmt.spec.js +++ b/tests/format/yaml/prettier-ignore/jsfmt.spec.js @@ -1 +1,3 @@ run_spec(__dirname, ["yaml"]); +// support --no-yaml-break-before-comment +run_spec(__dirname, ["yaml"], { yamlBreakBeforeComment: false }); diff --git a/tests/format/yaml/sequence/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/sequence/__snapshots__/jsfmt.spec.js.snap index 4da55680f4..d220b36ef7 100644 --- a/tests/format/yaml/sequence/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/sequence/__snapshots__/jsfmt.spec.js.snap @@ -19,6 +19,25 @@ tabWidth: 4 ================================================================================ `; +exports[`items.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- 123 +- 456 +- 789 + +=====================================output===================================== +- 123 +- 456 +- 789 + +================================================================================ +`; + exports[`items.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -48,9 +67,28 @@ tabWidth: 4 - 123 =====================================output===================================== +!!set +# comment +- 123 + +================================================================================ +`; + +exports[`middle-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== !!set # comment - 123 +=====================================output===================================== +!!set +# comment +- 123 + ================================================================================ `; @@ -64,7 +102,8 @@ printWidth: 80 - 123 =====================================output===================================== -!!set # comment +!!set +# comment - 123 ================================================================================ @@ -90,6 +129,26 @@ tabWidth: 4 ================================================================================ `; +exports[`middle-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!set # comment 1 +# comment 2 +- 123 + +=====================================output===================================== +!!set +# comment 1 +# comment 2 +- 123 + +================================================================================ +`; + exports[`middle-comments.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -132,6 +191,29 @@ tabWidth: 4 ================================================================================ `; +exports[`nested.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- 1 +- - 2-1 + - 2-2 +- - - 3-1-1 + - 3-2-1 + +=====================================output===================================== +- 1 +- - 2-1 + - 2-2 +- - - 3-1-1 + - 3-2-1 + +================================================================================ +`; + exports[`nested.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -169,6 +251,21 @@ tabWidth: 4 ================================================================================ `; +exports[`null-item.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- + +=====================================output===================================== +- + +================================================================================ +`; + exports[`null-item.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -203,6 +300,26 @@ tabWidth: 4 ================================================================================ `; +exports[`props.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- !!set &anchor +- 123 +- 456 + +=====================================output===================================== +--- +!!set &anchor +- 123 +- 456 + +================================================================================ +`; + exports[`props.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -241,6 +358,25 @@ a: !!set &anchor ================================================================================ `; +exports[`props-in-map.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: !!set &anchor +- 123 +- 456 + +=====================================output===================================== +a: !!set &anchor + - 123 + - 456 + +================================================================================ +`; + exports[`props-in-map.yml format 1`] = ` ====================================options===================================== parsers: ["yaml"] diff --git a/tests/format/yaml/sequence/jsfmt.spec.js b/tests/format/yaml/sequence/jsfmt.spec.js index 6fbe16994e..34206c0b8e 100644 --- a/tests/format/yaml/sequence/jsfmt.spec.js +++ b/tests/format/yaml/sequence/jsfmt.spec.js @@ -1,2 +1,4 @@ run_spec(__dirname, ["yaml"]); run_spec(__dirname, ["yaml"], { tabWidth: 4 }); +// support --no-yaml-break-before-comment +run_spec(__dirname, ["yaml"], { yamlBreakBeforeComment: false }); diff --git a/tests/format/yaml/spec/__snapshots__/jsfmt.spec.js.snap b/tests/format/yaml/spec/__snapshots__/jsfmt.spec.js.snap index 138558258d..7dba0caf7f 100644 --- a/tests/format/yaml/spec/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/yaml/spec/__snapshots__/jsfmt.spec.js.snap @@ -42,6 +42,27 @@ useTabs: true ================================================================================ `; +exports[`aliases-in-block-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- &a a +- &b b +- *a +- *b + +=====================================output===================================== +- &a a +- &b b +- *a +- *b + +================================================================================ +`; + exports[`aliases-in-explicit-block-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -78,6 +99,24 @@ useTabs: true ================================================================================ `; +exports[`aliases-in-explicit-block-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? &a a +: &b b +: *a + +=====================================output===================================== +&a a: &b b +: *a + +================================================================================ +`; + exports[`allowed-characters-in-alias.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -112,6 +151,23 @@ b: *:@*!$": ================================================================================ `; +exports[`allowed-characters-in-alias.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: &:@*!$": scalar a +b: *:@*!$": + +=====================================output===================================== +a: &:@*!$": scalar a +b: *:@*!$": + +================================================================================ +`; + exports[`allowed-characters-in-keys.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -158,6 +214,29 @@ this is#not: a comment ================================================================================ `; +exports[`allowed-characters-in-keys.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`allowed-characters-in-plain-scalars.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -204,6 +283,29 @@ safe dash: -foo ================================================================================ `; +exports[`allowed-characters-in-plain-scalars.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`allowed-characters-in-quoted-mapping-key.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -238,6 +340,23 @@ useTabs: true ================================================================================ `; +exports[`allowed-characters-in-quoted-mapping-key.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`anchor-before-zero-indented-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -282,6 +401,28 @@ seq: &anchor ================================================================================ `; +exports[`anchor-before-zero-indented-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +seq: + &anchor +- a +- b + +=====================================output===================================== +--- +seq: &anchor + - a + - b + +================================================================================ +`; + exports[`anchor-with-unicode-character.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -316,6 +457,23 @@ useTabs: true ================================================================================ `; +exports[`anchor-with-unicode-character.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +- &😁 unicode anchor + +=====================================output===================================== +--- +- &😁 unicode anchor + +================================================================================ +`; + exports[`anchors-and-tags.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -358,6 +516,27 @@ useTabs: true ================================================================================ `; +exports[`anchors-and-tags.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== + - &a !!str a + - !!int 2 + - !!int &c 4 + - &d d + +=====================================output===================================== +- !!str &a a +- !!int 2 +- !!int &c 4 +- &d d + +================================================================================ +`; + exports[`anchors-in-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -392,6 +571,23 @@ c: &d d ================================================================================ `; +exports[`anchors-in-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +&a a: b +c: &d d + +=====================================output===================================== +&a a: b +c: &d d + +================================================================================ +`; + exports[`anchors-with-colon-in-name.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -428,6 +624,24 @@ foo: *a: ================================================================================ `; +exports[`anchors-with-colon-in-name.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +&a: key: &a value +foo: + *a: + +=====================================output===================================== +&a: key: &a value +foo: *a: + +================================================================================ +`; + exports[`backslashes-in-singlequotes.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -458,6 +672,21 @@ useTabs: true ================================================================================ `; +exports[`backslashes-in-singlequotes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +'foo: bar\\': baz' + +=====================================output===================================== +'foo: bar\\': baz' + +================================================================================ +`; + exports[`bare-document-after-document-end-marker.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -500,6 +729,27 @@ key: value ================================================================================ `; +exports[`bare-document-after-document-end-marker.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +scalar1 +... +key: value + +=====================================output===================================== +--- +scalar1 +--- +key: value + +================================================================================ +`; + exports[`blank-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -574,21 +824,58 @@ text: | ================================================================================ `; -exports[`block-mapping-with-missing-values.yml - {"proseWrap":"always"} format 1`] = ` +exports[`blank-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +yamlBreakBeforeComment: false | printWidth =====================================input====================================== -? a -? b -c: +foo: 1 + +bar: 2 + +text: | + a + + b + + c + + d =====================================output===================================== -a: -b: -c: +foo: 1 + +bar: 2 + +text: | + a + + b + + c + + d + +================================================================================ +`; + +exports[`block-mapping-with-missing-values.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +? a +? b +c: + +=====================================output===================================== +a: +b: +c: ================================================================================ `; @@ -612,6 +899,25 @@ c: ================================================================================ `; +exports[`block-mapping-with-missing-values.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? a +? b +c: + +=====================================output===================================== +a: +b: +c: + +================================================================================ +`; + exports[`block-mapping-with-multiline-scalars.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -658,6 +964,31 @@ useTabs: true ================================================================================ `; +exports[`block-mapping-with-multiline-scalars.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? a + true +: null + d +? e + 42 + +=====================================output===================================== +? a + true +: null + d +? e + 42 + +================================================================================ +`; + exports[`block-mappings-in-block-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -698,6 +1029,26 @@ useTabs: true ================================================================================ `; +exports[`block-mappings-in-block-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== + - key: value + key2: value2 + - + key3: value3 + +=====================================output===================================== +- key: value + key2: value2 +- key3: value3 + +================================================================================ +`; + exports[`block-scalar-indicator-order.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -740,6 +1091,27 @@ useTabs: true ================================================================================ `; +exports[`block-scalar-indicator-order.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- |2- + explicit indent and chomp +- |-2 + chomp and explicit indent + +=====================================output===================================== +- |2- + explicit indent and chomp +- |2- + chomp and explicit indent + +================================================================================ +`; + exports[`block-scalar-keep.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -783,6 +1155,29 @@ useTabs: true +================================================================================ +`; + +exports[`block-scalar-keep.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- |+ + ab + + +... + +=====================================output===================================== +--- +|+ + ab + + + ================================================================================ `; @@ -817,6 +1212,26 @@ useTabs: true ab +... + +=====================================output===================================== +|- + ab + +================================================================================ +`; + +exports[`block-scalar-strip.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +|- + ab + + ... =====================================output===================================== @@ -864,6 +1279,25 @@ key: ================================================================================ `; +exports[`block-sequence-in-block-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key: + - item1 + - item2 + +=====================================output===================================== +key: + - item1 + - item2 + +================================================================================ +`; + exports[`block-sequence-in-block-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -902,6 +1336,25 @@ useTabs: true ================================================================================ `; +exports[`block-sequence-in-block-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- - s1_i1 + - s1_i2 +- s2 + +=====================================output===================================== +- - s1_i1 + - s1_i2 +- s2 + +================================================================================ +`; + exports[`block-submapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -940,6 +1393,25 @@ baz: 2 ================================================================================ `; +exports[`block-submapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +foo: + bar: 1 +baz: 2 + +=====================================output===================================== +foo: + bar: 1 +baz: 2 + +================================================================================ +`; + exports[`colon-in-double-quoted-string.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -970,6 +1442,21 @@ useTabs: true ================================================================================ `; +exports[`colon-in-double-quoted-string.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +"foo: bar\\": baz" + +=====================================output===================================== +'foo: bar": baz' + +================================================================================ +`; + exports[`comment-in-flow-sequence-before-comma.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1016,6 +1503,29 @@ useTabs: true ================================================================================ `; +exports[`comment-in-flow-sequence-before-comma.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +[ word1 +# comment +, word2] + +=====================================output===================================== +--- +[ + word1, + # comment + word2, +] + +================================================================================ +`; + exports[`construct-binary.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1088,6 +1598,42 @@ description: The binary value above is a tiny arrow encoded as a gif image. ================================================================================ `; +exports[`construct-binary.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`document-start-on-last-line.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1128,11 +1674,31 @@ a: b ================================================================================ `; -exports[`document-with-footer.yml - {"proseWrap":"always"} format 1`] = ` +exports[`document-start-on-last-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +a: b +--- + +=====================================output===================================== +--- +a: b +--- + + +================================================================================ +`; + +exports[`document-with-footer.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" | printWidth =====================================input====================================== aaa: bbb @@ -1160,6 +1726,22 @@ aaa: bbb ================================================================================ `; +exports[`document-with-footer.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +aaa: bbb +... + +=====================================output===================================== +aaa: bbb + +================================================================================ +`; + exports[`empty-lines-at-end-of-document.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1190,6 +1772,24 @@ useTabs: true +=====================================output===================================== +: + +================================================================================ +`; + +exports[`empty-lines-at-end-of-document.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +: + + + + =====================================output===================================== : @@ -1226,6 +1826,26 @@ useTabs: true 1: 2 +3: 4 + +=====================================output===================================== +1: 2 + +3: 4 + +================================================================================ +`; + +exports[`empty-lines-between-mapping-elements.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +1: 2 + + 3: 4 =====================================output===================================== @@ -1262,6 +1882,19 @@ useTabs: true ================================================================================ `; +exports[`empty-stream.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== + +=====================================output===================================== + +================================================================================ +`; + exports[`escaped-slash-in-double-quotes.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1292,6 +1925,21 @@ escaped slash: "a\\/b" ================================================================================ `; +exports[`escaped-slash-in-double-quotes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +escaped slash: "a\\/b" + +=====================================output===================================== +escaped slash: "a\\/b" + +================================================================================ +`; + exports[`explicit-non-specific-tag.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1322,6 +1970,21 @@ useTabs: true ================================================================================ `; +exports[`explicit-non-specific-tag.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +! a + +=====================================output===================================== +! a + +================================================================================ +`; + exports[`flow-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1352,6 +2015,21 @@ useTabs: true ================================================================================ `; +exports[`flow-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{foo: you, bar: far} + +=====================================output===================================== +{ foo: you, bar: far } + +================================================================================ +`; + exports[`flow-mapping-in-block-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1382,6 +2060,21 @@ useTabs: true ================================================================================ `; +exports[`flow-mapping-in-block-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- {a: b} + +=====================================output===================================== +- { a: b } + +================================================================================ +`; + exports[`flow-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1412,6 +2105,21 @@ useTabs: true ================================================================================ `; +exports[`flow-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[foo, bar, 42] + +=====================================output===================================== +[foo, bar, 42] + +================================================================================ +`; + exports[`flow-sequence-in-block-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1442,6 +2150,21 @@ a: [b, c] ================================================================================ `; +exports[`flow-sequence-in-block-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: [b, c] + +=====================================output===================================== +a: [b, c] + +================================================================================ +`; + exports[`flow-sequence-in-flow-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1472,6 +2195,21 @@ useTabs: true ================================================================================ `; +exports[`flow-sequence-in-flow-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{a: [b, c], [d, e]: f} + +=====================================output===================================== +{ a: [b, c], [d, e]: f } + +================================================================================ +`; + exports[`flow-sequence-in-flow-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1502,6 +2240,21 @@ useTabs: true ================================================================================ `; +exports[`flow-sequence-in-flow-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[a, [b, c]] + +=====================================output===================================== +[a, [b, c]] + +================================================================================ +`; + exports[`folded-block-scalar.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1559,6 +2312,35 @@ useTabs: true ================================================================================ `; +exports[`folded-block-scalar.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +> + ab + cd + + ef + + + gh + +=====================================output===================================== +> + ab + cd + + ef + + + gh + +================================================================================ +`; + exports[`implicit-flow-mapping-key-on-one-line.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1589,6 +2371,21 @@ useTabs: true ================================================================================ `; +exports[`implicit-flow-mapping-key-on-one-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[flow]: block + +=====================================output===================================== +[flow]: block + +================================================================================ +`; + exports[`key-with-anchor-after-missing-explicit-mapping-value.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1631,6 +2428,27 @@ b: ================================================================================ `; +exports[`key-with-anchor-after-missing-explicit-mapping-value.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +a: 1 +? b +&anchor c: 3 + +=====================================output===================================== +--- +a: 1 +b: +&anchor c: 3 + +================================================================================ +`; + exports[`literal-block-scalar.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1683,19 +2501,45 @@ a: | ================================================================================ `; -exports[`literal-unicode.yml - {"proseWrap":"always"} format 1`] = ` +exports[`literal-block-scalar.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +yamlBreakBeforeComment: false | printWidth =====================================input====================================== ---- -wanted: love ♥ and peace ☮ +a: | + ab + + cd + ef + -=====================================output===================================== ---- -wanted: love ♥ and peace ☮ +... + +=====================================output===================================== +a: | + ab + + cd + ef + +================================================================================ +`; + +exports[`literal-unicode.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +--- +wanted: love ♥ and peace ☮ + +=====================================output===================================== +--- +wanted: love ♥ and peace ☮ ================================================================================ `; @@ -1717,6 +2561,23 @@ wanted: love ♥ and peace ☮ ================================================================================ `; +exports[`literal-unicode.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +wanted: love ♥ and peace ☮ + +=====================================output===================================== +--- +wanted: love ♥ and peace ☮ + +================================================================================ +`; + exports[`lookahead-test-cases.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1751,6 +2612,23 @@ useTabs: true ================================================================================ `; +exports[`lookahead-test-cases.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- bla"keks: foo +- bla]keks: foo + +=====================================output===================================== +- bla"keks: foo +- bla]keks: foo + +================================================================================ +`; + exports[`mapping-key-and-flow-sequence-item-anchors.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1789,6 +2667,25 @@ useTabs: true ================================================================================ `; +exports[`mapping-key-and-flow-sequence-item-anchors.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +&mapping +&key [ &item a, b, c ]: value + +=====================================output===================================== +--- +&mapping +&key [&item a, b, c]: value + +================================================================================ +`; + exports[`mixed-block-mapping-explicit-to-implicit.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1825,6 +2722,24 @@ a: 13 ================================================================================ `; +exports[`mixed-block-mapping-explicit-to-implicit.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? a +: 13 +1.5: d + +=====================================output===================================== +a: 13 +1.5: d + +================================================================================ +`; + exports[`mixed-block-mapping-implicit-to-explicit.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1861,6 +2776,24 @@ a: 4.2 ================================================================================ `; +exports[`mixed-block-mapping-implicit-to-explicit.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: 4.2 +? 23 +: d + +=====================================output===================================== +a: 4.2 +23: d + +================================================================================ +`; + exports[`multi-level-mapping-indent.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1911,6 +2844,31 @@ h: i ================================================================================ `; +exports[`multi-level-mapping-indent.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: + b: + c: d + e: + f: g +h: i + +=====================================output===================================== +a: + b: + c: d + e: + f: g +h: i + +================================================================================ +`; + exports[`multiline-plain-scalar-with-empty-line.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -1956,6 +2914,29 @@ plain: a ================================================================================ `; +exports[`multiline-plain-scalar-with-empty-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +plain: a + b + + c + +=====================================output===================================== +--- +plain: a + b + + c + +================================================================================ +`; + exports[`multiline-scalar-at-top-level.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2003,6 +2984,31 @@ e ================================================================================ `; +exports[`multiline-scalar-at-top-level.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a +b + c +d + +e + +=====================================output===================================== +a +b +c +d + +e + +================================================================================ +`; + exports[`multiline-scalar-in-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2045,6 +3051,28 @@ d: e ================================================================================ `; +exports[`multiline-scalar-in-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: b + c +d: + e + f + +=====================================output===================================== +a: b + c +d: e + f + +================================================================================ +`; + exports[`multiline-scalar-that-looks-like-a-yaml-directive.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2082,6 +3110,25 @@ scalar ================================================================================ `; +exports[`multiline-scalar-that-looks-like-a-yaml-directive.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +scalar +%YAML 1.2 + +=====================================output===================================== +--- +scalar +%YAML 1.2 + +================================================================================ +`; + exports[`multiple-entry-block-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2120,6 +3167,25 @@ useTabs: true ================================================================================ `; +exports[`multiple-entry-block-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- foo +- bar +- 42 + +=====================================output===================================== +- foo +- bar +- 42 + +================================================================================ +`; + exports[`multiple-pair-block-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2158,6 +3224,25 @@ baz: jazz ================================================================================ `; +exports[`multiple-pair-block-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +foo: blue +bar: arrr +baz: jazz + +=====================================output===================================== +foo: blue +bar: arrr +baz: jazz + +================================================================================ +`; + exports[`nested-flow-collections.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2204,15 +3289,21 @@ useTabs: true ================================================================================ `; -exports[`nested-flow-collections-on-one-line.yml - {"proseWrap":"always"} format 1`] = ` +exports[`nested-flow-collections.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +yamlBreakBeforeComment: false | printWidth =====================================input====================================== --- -{ a: [b, c, { d: [e, f] } ] } +{ + a: [ + b, c, { + d: [e, f] + } + ] +} =====================================output===================================== --- @@ -2221,11 +3312,11 @@ proseWrap: "always" ================================================================================ `; -exports[`nested-flow-collections-on-one-line.yml - {"useTabs":true} format 1`] = ` +exports[`nested-flow-collections-on-one-line.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +proseWrap: "always" | printWidth =====================================input====================================== --- @@ -2238,7 +3329,41 @@ useTabs: true ================================================================================ `; -exports[`node-anchor-and-tag-on-seperate-lines.yml - {"proseWrap":"always"} format 1`] = ` +exports[`nested-flow-collections-on-one-line.yml - {"useTabs":true} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +useTabs: true + | printWidth +=====================================input====================================== +--- +{ a: [b, c, { d: [e, f] } ] } + +=====================================output===================================== +--- +{ a: [b, c, { d: [e, f] }] } + +================================================================================ +`; + +exports[`nested-flow-collections-on-one-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +{ a: [b, c, { d: [e, f] } ] } + +=====================================output===================================== +--- +{ a: [b, c, { d: [e, f] }] } + +================================================================================ +`; + +exports[`node-anchor-and-tag-on-seperate-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 @@ -2274,6 +3399,24 @@ key: !!map &anchor ================================================================================ `; +exports[`node-anchor-and-tag-on-seperate-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key: &anchor + !!map + a: b + +=====================================output===================================== +key: !!map &anchor + a: b + +================================================================================ +`; + exports[`node-and-mapping-key-anchors.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2303,7 +3446,8 @@ top7: --- top1: &node1 &k1 key1: one -top2: &node2 # comment +top2: &node2 + # comment key2: two top3: &k3 key3: three @@ -2344,12 +3488,57 @@ top7: =====================================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[`node-and-mapping-key-anchors.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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 @@ -2410,6 +3599,31 @@ useTabs: true ================================================================================ `; +exports[`non-specific-tags-on-scalars.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- plain +- "double quoted" +- 'single quoted' +- > + block +- plain again + +=====================================output===================================== +- plain +- "double quoted" +- "single quoted" +- > + block +- plain again + +================================================================================ +`; + exports[`plain-mapping-key-ending-with-colon.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2444,6 +3658,23 @@ key ends with two colons::: value ================================================================================ `; +exports[`plain-mapping-key-ending-with-colon.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +key ends with two colons::: value + +=====================================output===================================== +--- +key ends with two colons::: value + +================================================================================ +`; + exports[`plain-scalar-looking-like-key-comment-anchor-and-tag.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2477,6 +3708,23 @@ k:#foo ================================================================================ `; +exports[`plain-scalar-looking-like-key-comment-anchor-and-tag.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +k:#foo + &a !t s + +=====================================output===================================== +k:#foo +&a !t s + +================================================================================ +`; + exports[`plain-scalar-with-backslashes.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2511,6 +3759,23 @@ plain\\value\\with\\backslashes ================================================================================ `; +exports[`plain-scalar-with-backslashes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +plain\\value\\with\\backslashes + +=====================================output===================================== +--- +plain\\value\\with\\backslashes + +================================================================================ +`; + exports[`plain-url-in-flow-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2541,6 +3806,21 @@ useTabs: true ================================================================================ `; +exports[`plain-url-in-flow-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- { url: http://example.org } + +=====================================output===================================== +- { url: http://example.org } + +================================================================================ +`; + exports[`scalars-on-line.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2582,6 +3862,27 @@ string" ================================================================================ `; +exports[`scalars-on-line.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- "quoted +string" +--- &node foo + +=====================================output===================================== +--- +"quoted +string" +--- +&node foo + +================================================================================ +`; + exports[`sequence-entry-that-looks-like-two-with-wrong-indentation.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2615,6 +3916,23 @@ useTabs: true ================================================================================ `; +exports[`sequence-entry-that-looks-like-two-with-wrong-indentation.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- single multiline + - sequence entry + +=====================================output===================================== +- single multiline + - sequence entry + +================================================================================ +`; + exports[`sequence-indent.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2657,6 +3975,27 @@ bar: ================================================================================ `; +exports[`sequence-indent.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +foo: +- 42 +bar: + - 44 + +=====================================output===================================== +foo: + - 42 +bar: + - 44 + +================================================================================ +`; + exports[`sequence-with-same-indentation-as-parent-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2699,6 +4038,27 @@ useTabs: true ================================================================================ `; +exports[`sequence-with-same-indentation-as-parent-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +1: +- 2 +- 3 +4: 5 + +=====================================output===================================== +1: + - 2 + - 3 +4: 5 + +================================================================================ +`; + exports[`simple-mapping-indent.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2733,6 +4093,23 @@ foo: ================================================================================ `; +exports[`simple-mapping-indent.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +foo: + bar: baz + +=====================================output===================================== +foo: + bar: baz + +================================================================================ +`; + exports[`single-entry-block-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2763,6 +4140,21 @@ useTabs: true ================================================================================ `; +exports[`single-entry-block-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- foo + +=====================================output===================================== +- foo + +================================================================================ +`; + exports[`single-pair-block-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2793,6 +4185,21 @@ foo: bar ================================================================================ `; +exports[`single-pair-block-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +foo: bar + +=====================================output===================================== +foo: bar + +================================================================================ +`; + exports[`spec-example-2-1-sequence-of-scalars.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2831,11 +4238,49 @@ useTabs: true ================================================================================ `; -exports[`spec-example-2-2-mapping-scalars-to-scalars.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-2-1-sequence-of-scalars.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +=====================================output===================================== +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +================================================================================ +`; + +exports[`spec-example-2-2-mapping-scalars-to-scalars.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | 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[`spec-example-2-2-mapping-scalars-to-scalars.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== hr: 65 # Home runs @@ -2850,11 +4295,11 @@ rbi: 147 # Runs Batted In ================================================================================ `; -exports[`spec-example-2-2-mapping-scalars-to-scalars.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-2-2-mapping-scalars-to-scalars.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== hr: 65 # Home runs @@ -2927,6 +4372,35 @@ national: ================================================================================ `; +exports[`spec-example-2-3-mapping-scalars-to-sequences.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-4-sequence-of-mappings.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -2981,6 +4455,33 @@ useTabs: true ================================================================================ `; +exports[`spec-example-2-4-sequence-of-mappings.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-5-sequence-of-sequences.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3019,6 +4520,25 @@ useTabs: true ================================================================================ `; +exports[`spec-example-2-5-sequence-of-sequences.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-6-mapping-of-mappings.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3059,6 +4579,26 @@ Sammy Sosa: { hr: 63, avg: 0.288 } ================================================================================ `; +exports[`spec-example-2-6-mapping-of-mappings.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-7-two-documents-in-a-stream.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3125,6 +4665,39 @@ useTabs: true ================================================================================ `; +exports[`spec-example-2-7-two-documents-in-a-stream.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-8-play-by-play-feed-from-a-game.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3187,6 +4760,37 @@ action: grand slam ================================================================================ `; +exports[`spec-example-2-8-play-by-play-feed-from-a-game.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-9-single-document-with-two-comments.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3245,6 +4849,35 @@ rbi: ================================================================================ `; +exports[`spec-example-2-9-single-document-with-two-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-10-node-for-sammy-sosa-appears-twice-in-this-document.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3303,6 +4936,35 @@ rbi: ================================================================================ `; +exports[`spec-example-2-10-node-for-sammy-sosa-appears-twice-in-this-document.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-11-mapping-between-sequences.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3352,16 +5014,72 @@ useTabs: true - Chicago cubs : - 2001-07-23 -[New York Yankees, Atlanta Braves]: [2001-07-02, 2001-08-12, 2001-08-14] +[New York Yankees, Atlanta Braves]: [2001-07-02, 2001-08-12, 2001-08-14] + +================================================================================ +`; + +exports[`spec-example-2-11-mapping-between-sequences.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-12-compact-nested-mapping.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | 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[`spec-example-2-12-compact-nested-mapping.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-2-12-compact-nested-mapping.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== --- @@ -3386,11 +5104,11 @@ proseWrap: "always" ================================================================================ `; -exports[`spec-example-2-12-compact-nested-mapping.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-2-12-compact-nested-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== --- @@ -3459,6 +5177,28 @@ useTabs: true ================================================================================ `; +exports[`spec-example-2-13-in-literals-newlines-are-preserved.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +# ASCII Art +--- | + \\//||\\/|| + // || ||__ + +=====================================output===================================== +# ASCII Art +--- +| + \\//||\\/|| + // || ||__ + +================================================================================ +`; + exports[`spec-example-2-14-in-the-folded-scalars-newlines-become-spaces.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3501,6 +5241,28 @@ useTabs: true ================================================================================ `; +exports[`spec-example-2-14-in-the-folded-scalars-newlines-become-spaces.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- > + Mark McGwire's + year was crippled + by a knee injury. + +=====================================output===================================== +--- +> + Mark McGwire's + year was crippled + by a knee injury. + +================================================================================ +`; + exports[`spec-example-2-15-folded-newlines-are-preserved-for-more-indented-and-blank-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3558,6 +5320,35 @@ useTabs: true ================================================================================ `; +exports[`spec-example-2-15-folded-newlines-are-preserved-for-more-indented-and-blank-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-16-indentation-determines-scope.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3611,6 +5402,33 @@ stats: | ================================================================================ `; +exports[`spec-example-2-16-indentation-determines-scope.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-17-quoted-scalars.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3665,6 +5483,33 @@ tie-fighter: '|\\-*-/|' ================================================================================ `; +exports[`spec-example-2-17-quoted-scalars.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-18-multi-line-flow-scalars.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3711,6 +5556,30 @@ quoted: "So does this ================================================================================ `; +exports[`spec-example-2-18-multi-line-flow-scalars.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-23-various-explicit-tags.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3789,6 +5658,45 @@ application specific tag: !something | ================================================================================ `; +exports[`spec-example-2-23-various-explicit-tags.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +not-date: !!str 2002-04-28 + +picture: !!binary | + R0lGODlhDAAMAIQAAP//9/X + 17unp5WZmZgAAAOfn515eXv + Pz7Y6OjuDg4J+fn5OTk6enp + 56enmleECcgggoBADs= + +application specific tag: !something | + The semantics of the tag + above may be different for + different documents. + +=====================================output===================================== +--- +not-date: !!str 2002-04-28 + +picture: !!binary | + R0lGODlhDAAMAIQAAP//9/X + 17unp5WZmZgAAAOfn515eXv + Pz7Y6OjuDg4J+fn5OTk6enp + 56enmleECcgggoBADs= + +application specific tag: !something | + The semantics of the tag + above may be different for + different documents. + +================================================================================ +`; + exports[`spec-example-2-24-global-tags.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -3873,11 +5781,81 @@ useTabs: true ================================================================================ `; -exports[`spec-example-2-25-unordered-sets.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-2-24-global-tags.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-25-unordered-sets.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | 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[`spec-example-2-25-unordered-sets.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== # Sets are represented as a @@ -3901,11 +5879,11 @@ proseWrap: "always" ================================================================================ `; -exports[`spec-example-2-25-unordered-sets.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-2-25-unordered-sets.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== # Sets are represented as a @@ -3985,6 +5963,34 @@ useTabs: true ================================================================================ `; +exports[`spec-example-2-26-ordered-mappings.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +# 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===================================== +# 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[`spec-example-2-27-invoice.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4125,6 +6131,77 @@ comments: Late afternoon is best. ================================================================================ `; +exports[`spec-example-2-27-invoice.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-2-28-log-file.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4247,6 +6324,68 @@ Stack: ================================================================================ `; +exports[`spec-example-2-28-log-file.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-5-3-block-structure-indicators.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4299,6 +6438,32 @@ mapping: ================================================================================ `; +exports[`spec-example-5-3-block-structure-indicators.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +sequence: +- one +- two +mapping: + ? sky + : blue + sea : green + +=====================================output===================================== +sequence: + - one + - two +mapping: + sky: blue + sea: green + +================================================================================ +`; + exports[`spec-example-5-4-flow-collection-indicators.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4333,6 +6498,23 @@ mapping: { sky: blue, sea: green } ================================================================================ `; +exports[`spec-example-5-4-flow-collection-indicators.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +sequence: [ one, two, ] +mapping: { sky: blue, sea: green } + +=====================================output===================================== +sequence: [one, two] +mapping: { sky: blue, sea: green } + +================================================================================ +`; + exports[`spec-example-5-5-comment-indicator.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4363,6 +6545,21 @@ useTabs: true ================================================================================ `; +exports[`spec-example-5-5-comment-indicator.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +# Comment only. + +=====================================output===================================== +# Comment only. + +================================================================================ +`; + exports[`spec-example-5-6-node-property-indicators.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4397,11 +6594,52 @@ alias: *anchor ================================================================================ `; +exports[`spec-example-5-6-node-property-indicators.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +anchored: !local &anchor value +alias: *anchor + +=====================================output===================================== +anchored: !local &anchor value +alias: *anchor + +================================================================================ +`; + exports[`spec-example-5-7-block-scalar-indicators.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +proseWrap: "always" + | printWidth +=====================================input====================================== +literal: | + some + text +folded: > + some + text + +=====================================output===================================== +literal: | + some + text +folded: > + some text + +================================================================================ +`; + +exports[`spec-example-5-7-block-scalar-indicators.yml - {"useTabs":true} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +useTabs: true | printWidth =====================================input====================================== literal: | @@ -4416,16 +6654,17 @@ literal: | some text folded: > - some text + some + text ================================================================================ `; -exports[`spec-example-5-7-block-scalar-indicators.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-5-7-block-scalar-indicators.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== literal: | @@ -4480,6 +6719,23 @@ double: "text" ================================================================================ `; +exports[`spec-example-5-8-quoted-scalar-indicators.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +single: 'text' +double: "text" + +=====================================output===================================== +single: "text" +double: "text" + +================================================================================ +`; + exports[`spec-example-5-9-directive-indicator.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4516,6 +6772,24 @@ text ================================================================================ `; +exports[`spec-example-5-9-directive-indicator.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +%YAML 1.2 +--- text + +=====================================output===================================== +%YAML 1.2 +--- +text + +================================================================================ +`; + exports[`spec-example-5-12-tabs-and-spaces.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4566,6 +6840,31 @@ block: | ================================================================================ `; +exports[`spec-example-5-12-tabs-and-spaces.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-6-1-indentation-spaces.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4642,6 +6941,44 @@ Not indented: ================================================================================ `; +exports[`spec-example-6-1-indentation-spaces.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-6-2-indentation-indicators.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4684,6 +7021,27 @@ a: ================================================================================ `; +exports[`spec-example-6-2-indentation-indicators.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? a +: - b + - - c + - d + +=====================================output===================================== +a: + - b + - - c + - d + +================================================================================ +`; + exports[`spec-example-6-3-separation-spaces.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4722,6 +7080,25 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-3-separation-spaces.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- foo: bar +- - baz + - baz + +=====================================output===================================== +- foo: bar +- - baz + - baz + +================================================================================ +`; + exports[`spec-example-6-4-line-prefixes.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4774,6 +7151,33 @@ block: | ================================================================================ `; +exports[`spec-example-6-4-line-prefixes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +plain: text + lines +quoted: "text + lines" +block: | + text + lines + +=====================================output===================================== +plain: text + lines +quoted: "text + lines" +block: | + text + lines + +================================================================================ +`; + exports[`spec-example-6-5-empty-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -4816,6 +7220,32 @@ Chomping: | +=====================================output===================================== +Folding: "Empty line + + as a line feed" +Chomping: | + Clipped empty lines + +================================================================================ +`; + +exports[`spec-example-6-5-empty-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +Folding: + "Empty line + + as a line feed" +Chomping: | + Clipped empty lines + + + =====================================output===================================== Folding: "Empty line @@ -4873,6 +7303,33 @@ useTabs: true + as + space + +================================================================================ +`; + +exports[`spec-example-6-6-line-folding.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +>- + trimmed + + + + as + space + +=====================================output===================================== +>- + trimmed + + + as space @@ -4924,16 +7381,68 @@ useTabs: true bar - baz + baz + +================================================================================ +`; + +exports[`spec-example-6-7-block-folding.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +> + foo + + bar + + baz + +=====================================output===================================== +> + foo + + bar + + baz + +================================================================================ +`; + +exports[`spec-example-6-8-flow-folding.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +" + foo + + bar + + baz +" + +=====================================output===================================== +" +foo + +bar + +baz +" ================================================================================ `; -exports[`spec-example-6-8-flow-folding.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-6-8-flow-folding.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== " @@ -4956,11 +7465,11 @@ baz ================================================================================ `; -exports[`spec-example-6-8-flow-folding.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-6-8-flow-folding.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== " @@ -5017,6 +7526,23 @@ key: # Comment ================================================================================ `; +exports[`spec-example-6-9-separated-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key: # Comment + value + +=====================================output===================================== +key: # Comment + value + +================================================================================ +`; + exports[`spec-example-6-10-comment-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5047,6 +7573,24 @@ useTabs: true +=====================================output===================================== +# Comment + +================================================================================ +`; + +exports[`spec-example-6-10-comment-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== + # Comment + + + + =====================================output===================================== # Comment @@ -5087,6 +7631,27 @@ key: # Comment +=====================================output===================================== +key: # Comment + # lines + value + +================================================================================ +`; + +exports[`spec-example-6-11-multi-line-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +key: # Comment + # lines + value + + + =====================================output===================================== key: # Comment # lines @@ -5145,6 +7710,31 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-12-separation-spaces.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-6-13-reserved-directives.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5185,6 +7775,26 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-13-reserved-directives.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +%FOO bar baz # Should be ignored + # with a warning. +--- "foo" + +=====================================output===================================== +%FOO bar baz # Should be ignored +# with a warning. +--- +"foo" + +================================================================================ +`; + exports[`spec-example-6-14-yaml-directive.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5227,6 +7837,27 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-14-yaml-directive.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +%YAML 1.3 # Attempt parsing + # with a warning +--- +"foo" + +=====================================output===================================== +%YAML 1.3 # Attempt parsing +# with a warning +--- +"foo" + +================================================================================ +`; + exports[`spec-example-6-16-tag-directive.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5265,6 +7896,25 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-16-tag-directive.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +%TAG !yaml! tag:yaml.org,2002: +--- +!yaml!str "foo" + +=====================================output===================================== +%TAG !yaml! tag:yaml.org,2002: +--- +!yaml!str "foo" + +================================================================================ +`; + exports[`spec-example-6-18-primary-tag-handle.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5319,6 +7969,33 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-18-primary-tag-handle.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-6-19-secondary-tag-handle.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5357,6 +8034,25 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-19-secondary-tag-handle.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-6-20-tag-handles.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5395,6 +8091,25 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-20-tag-handles.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +%TAG !e! tag:example.com,2000:app/ +--- +!e!foo "bar" + +=====================================output===================================== +%TAG !e! tag:example.com,2000:app/ +--- +!e!foo "bar" + +================================================================================ +`; + exports[`spec-example-6-21-local-tag-prefix.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5449,6 +8164,33 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-21-local-tag-prefix.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-6-22-global-tag-prefix.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5487,11 +8229,48 @@ useTabs: true ================================================================================ `; -exports[`spec-example-6-23-node-properties.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-6-22-global-tag-prefix.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +%TAG !e! tag:example.com,2000:app/ +--- +- !e!foo "bar" + +=====================================output===================================== +%TAG !e! tag:example.com,2000:app/ +--- +- !e!foo "bar" + +================================================================================ +`; + +exports[`spec-example-6-23-node-properties.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +!!str &a1 "foo": + !!str bar +&a2 baz : *a1 + +=====================================output===================================== +!!str &a1 "foo": !!str bar +&a2 baz: *a1 + +================================================================================ +`; + +exports[`spec-example-6-23-node-properties.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== !!str &a1 "foo": @@ -5505,11 +8284,11 @@ proseWrap: "always" ================================================================================ `; -exports[`spec-example-6-23-node-properties.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-6-23-node-properties.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== !!str &a1 "foo": @@ -5555,6 +8334,22 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-24-verbatim-tags.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +! foo : + ! baz + +=====================================output===================================== +! foo: ! baz + +================================================================================ +`; + exports[`spec-example-6-26-tag-shorthands.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5601,6 +8396,29 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-26-tag-shorthands.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-6-28-non-specific-tags.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5643,6 +8461,27 @@ useTabs: true ================================================================================ `; +exports[`spec-example-6-28-non-specific-tags.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +# Assuming conventional resolution: +- "12" +- 12 +- ! 12 + +=====================================output===================================== +# Assuming conventional resolution: +- "12" +- 12 +- ! 12 + +================================================================================ +`; + exports[`spec-example-6-29-node-anchors.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5677,6 +8516,23 @@ Second occurrence: *anchor ================================================================================ `; +exports[`spec-example-6-29-node-anchors.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +First occurrence: &anchor Value +Second occurrence: *anchor + +=====================================output===================================== +First occurrence: &anchor Value +Second occurrence: *anchor + +================================================================================ +`; + exports[`spec-example-7-1-alias-nodes.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5719,6 +8575,27 @@ Reuse anchor: *anchor ================================================================================ `; +exports[`spec-example-7-1-alias-nodes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-7-2-empty-content.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5755,6 +8632,24 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-2-empty-content.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ + foo : !!str, + !!str : bar, +} + +=====================================output===================================== +{ foo: !!str , !!str : bar } + +================================================================================ +`; + exports[`spec-example-7-3-completely-empty-flow-nodes.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5791,6 +8686,24 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-3-completely-empty-flow-nodes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ + ? foo :, + : bar, +} + +=====================================output===================================== +{ foo, : bar } + +================================================================================ +`; + exports[`spec-example-7-4-double-quoted-implicit-keys.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5825,6 +8738,23 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-4-double-quoted-implicit-keys.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +"implicit block key" : [ + "implicit flow key" : value, + ] + +=====================================output===================================== +"implicit block key": ["implicit flow key": value] + +================================================================================ +`; + exports[`spec-example-7-5-double-quoted-line-breaks.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5870,6 +8800,29 @@ to a line feed, or \\ ================================================================================ `; +exports[`spec-example-7-5-double-quoted-line-breaks.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-7-6-double-quoted-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5911,6 +8864,27 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-6-double-quoted-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +" 1st non-empty + + 2nd non-empty + 3rd non-empty " + +=====================================output===================================== +" 1st non-empty + +2nd non-empty +3rd non-empty " + +================================================================================ +`; + exports[`spec-example-7-7-single-quoted-characters.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5941,6 +8915,21 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-7-single-quoted-characters.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +'here''s to "quotes"' + +=====================================output===================================== +'here''s to "quotes"' + +================================================================================ +`; + exports[`spec-example-7-8-single-quoted-implicit-keys.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -5975,6 +8964,23 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-8-single-quoted-implicit-keys.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +'implicit block key' : [ + 'implicit flow key' : value, + ] + +=====================================output===================================== +"implicit block key": ["implicit flow key": value] + +================================================================================ +`; + exports[`spec-example-7-9-single-quoted-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6008,19 +9014,73 @@ useTabs: true 3rd non-empty ' =====================================output===================================== -" 1st non-empty - -2nd non-empty -3rd non-empty " +" 1st non-empty + +2nd non-empty +3rd non-empty " + +================================================================================ +`; + +exports[`spec-example-7-9-single-quoted-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +' 1st non-empty + + 2nd non-empty + 3rd non-empty ' + +=====================================output===================================== +" 1st non-empty + +2nd non-empty +3rd non-empty " + +================================================================================ +`; + +exports[`spec-example-7-10-plain-characters.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | 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[`spec-example-7-10-plain-characters.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-7-10-plain-characters.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== # Outside flow collection: @@ -6049,11 +9109,11 @@ proseWrap: "always" ================================================================================ `; -exports[`spec-example-7-10-plain-characters.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-7-10-plain-characters.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== # Outside flow collection: @@ -6116,6 +9176,23 @@ implicit block key: [implicit flow key: value] ================================================================================ `; +exports[`spec-example-7-11-plain-implicit-keys.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +implicit block key : [ + implicit flow key : value, + ] + +=====================================output===================================== +implicit block key: [implicit flow key: value] + +================================================================================ +`; + exports[`spec-example-7-12-plain-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6157,6 +9234,27 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-12-plain-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +1st non-empty + + 2nd non-empty + 3rd non-empty + +=====================================output===================================== +1st non-empty + +2nd non-empty +3rd non-empty + +================================================================================ +`; + exports[`spec-example-7-13-flow-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6191,6 +9289,23 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-13-flow-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- [ one, two, ] +- [three ,four] + +=====================================output===================================== +- [one, two] +- [three, four] + +================================================================================ +`; + exports[`spec-example-7-14-flow-sequence-entries.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6244,6 +9359,37 @@ single: pair, ================================================================================ `; +exports[`spec-example-7-14-flow-sequence-entries.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ +"double + quoted", 'single + quoted', +plain + text, [ nested ], +single: pair, +] + +=====================================output===================================== +[ + "double + quoted", + "single + quoted", + plain + text, + [nested], + single: pair, +] + +================================================================================ +`; + exports[`spec-example-7-15-flow-mappings.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6278,6 +9424,23 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-15-flow-mappings.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- { one : two , three: four , } +- {five: six,seven : eight} + +=====================================output===================================== +- { one: two, three: four } +- { five: six, seven: eight } + +================================================================================ +`; + exports[`spec-example-7-16-flow-mapping-entries.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6316,6 +9479,25 @@ implicit: entry, ================================================================================ `; +exports[`spec-example-7-16-flow-mapping-entries.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ +? explicit: entry, +implicit: entry, +? +} + +=====================================output===================================== +{ explicit: entry, implicit: entry, : } + +================================================================================ +`; + exports[`spec-example-7-17-flow-mapping-separate-values.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6356,6 +9538,26 @@ omitted value:, ================================================================================ `; +exports[`spec-example-7-17-flow-mapping-separate-values.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ +unquoted : "separate", +http://foo.com, +omitted value:, +: omitted key, +} + +=====================================output===================================== +{ unquoted: "separate", http://foo.com, omitted value, : omitted key } + +================================================================================ +`; + exports[`spec-example-7-18-flow-mapping-adjacent-values.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6394,6 +9596,25 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-18-flow-mapping-adjacent-values.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +{ +"adjacent":value, +"readable": value, +"empty": +} + +=====================================output===================================== +{ "adjacent": value, "readable": value, "empty" } + +================================================================================ +`; + exports[`spec-example-7-19-single-pair-flow-mappings.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6428,6 +9649,23 @@ foo: bar ================================================================================ `; +exports[`spec-example-7-19-single-pair-flow-mappings.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ +foo: bar +] + +=====================================output===================================== +[foo: bar] + +================================================================================ +`; + exports[`spec-example-7-20-single-pair-explicit-entry.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6466,6 +9704,26 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-20-single-pair-explicit-entry.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +[ +? foo + bar : baz +] + +=====================================output===================================== +[? foo + bar + : baz] + +================================================================================ +`; + exports[`spec-example-7-21-single-pair-implicit-entries.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6504,6 +9762,25 @@ useTabs: true ================================================================================ `; +exports[`spec-example-7-21-single-pair-implicit-entries.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- [ YAML : separate ] +- [ : empty key entry ] +- [ {JSON: like}:adjacent ] + +=====================================output===================================== +- [YAML: separate] +- [: empty key entry] +- [{ JSON: like }: adjacent] + +================================================================================ +`; + exports[`spec-example-7-23-flow-content.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6550,11 +9827,57 @@ useTabs: true ================================================================================ `; -exports[`spec-example-7-24-flow-nodes.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-7-23-flow-content.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- [ a, b ] +- { a: b } +- "a" +- 'b' +- c + +=====================================output===================================== +- [a, b] +- { a: b } +- "a" +- "b" +- c + +================================================================================ +`; + +exports[`spec-example-7-24-flow-nodes.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +- !!str "a" +- 'b' +- &anchor "c" +- *anchor +- !!str + +=====================================output===================================== +- !!str "a" +- "b" +- &anchor "c" +- *anchor +- !!str + +================================================================================ +`; + +exports[`spec-example-7-24-flow-nodes.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== - !!str "a" @@ -6573,11 +9896,11 @@ proseWrap: "always" ================================================================================ `; -exports[`spec-example-7-24-flow-nodes.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-7-24-flow-nodes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== - !!str "a" @@ -6658,6 +9981,37 @@ useTabs: true ================================================================================ `; +exports[`spec-example-8-1-block-scalar-header.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-8-2-block-indentation-indicator.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6728,6 +10082,41 @@ useTabs: true ================================================================================ `; +exports[`spec-example-8-2-block-indentation-indicator.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- | + detected +- > + + + # detected +- |1 + explicit +- > + + detected + +=====================================output===================================== +- | + detected +- > + + + # detected +- |1 + explicit +- > + + detected + +================================================================================ +`; + exports[`spec-example-8-4-chomping-final-line-break.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6778,6 +10167,31 @@ keep: |+ ================================================================================ `; +exports[`spec-example-8-4-chomping-final-line-break.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +strip: |- + text +clip: | + text +keep: |+ + text + +=====================================output===================================== +strip: |- + text +clip: | + text +keep: |+ + text + +================================================================================ +`; + exports[`spec-example-8-5-chomping-trailing-lines.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6878,6 +10292,56 @@ keep: |+ ================================================================================ `; +exports[`spec-example-8-5-chomping-trailing-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-8-6-empty-scalar-chomping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -6925,6 +10389,31 @@ clip: > keep: |+ +================================================================================ +`; + +exports[`spec-example-8-6-empty-scalar-chomping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +strip: >- + +clip: > + +keep: |+ + + +=====================================output===================================== +strip: >- + +clip: > + +keep: |+ + + ================================================================================ `; @@ -6962,6 +10451,27 @@ useTabs: true +=====================================output===================================== +| + literal + text + +================================================================================ +`; + +exports[`spec-example-8-7-literal-scalar.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +| + literal + text + + + =====================================output===================================== | literal @@ -7032,6 +10542,37 @@ useTabs: true ================================================================================ `; +exports[`spec-example-8-8-literal-content.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +| + + + literal + + + text + + # Comment + +=====================================output===================================== +| + + + literal + + + text + +# Comment + +================================================================================ +`; + exports[`spec-example-8-9-folded-scalar.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7067,17 +10608,80 @@ useTabs: true =====================================output===================================== > - folded - text + folded + text + +================================================================================ +`; + +exports[`spec-example-8-9-folded-scalar.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +> + folded + text + + + +=====================================output===================================== +> + folded + text + +================================================================================ +`; + +exports[`spec-example-8-10-folded-lines-8-13-final-empty-lines.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +> + + folded + line + + next + line + * bullet + + * list + * lines + + last + line + +# Comment + +=====================================output===================================== +> + + folded line + + next line + * bullet + + * list + * lines + + last line + +# Comment ================================================================================ `; -exports[`spec-example-8-10-folded-lines-8-13-final-empty-lines.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-8-10-folded-lines-8-13-final-empty-lines.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== > @@ -7100,26 +10704,29 @@ proseWrap: "always" =====================================output===================================== > - folded line + folded + line - next line + next + line * bullet * list * lines - last line + last + line # Comment ================================================================================ `; -exports[`spec-example-8-10-folded-lines-8-13-final-empty-lines.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-8-10-folded-lines-8-13-final-empty-lines.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== > @@ -7198,6 +10805,25 @@ block sequence: ================================================================================ `; +exports[`spec-example-8-14-block-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +block sequence: + - one + - two : three + +=====================================output===================================== +block sequence: + - one + - two: three + +================================================================================ +`; + exports[`spec-example-8-15-block-sequence-entry-types.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7248,6 +10874,31 @@ useTabs: true ================================================================================ `; +exports[`spec-example-8-15-block-sequence-entry-types.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-8-16-block-mappings.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7282,6 +10933,23 @@ block mapping: ================================================================================ `; +exports[`spec-example-8-16-block-mappings.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +block mapping: + key: value + +=====================================output===================================== +block mapping: + key: value + +================================================================================ +`; + exports[`spec-example-8-17-explicit-block-mapping-entries.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7328,6 +10996,29 @@ useTabs: true ================================================================================ `; +exports[`spec-example-8-17-explicit-block-mapping-entries.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`spec-example-8-18-implicit-block-mapping-entries.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7370,6 +11061,27 @@ plain key: in-line value ================================================================================ `; +exports[`spec-example-8-18-implicit-block-mapping-entries.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +plain key: in-line value +: # Both empty +"quoted key": +- entry + +=====================================output===================================== +plain key: in-line value +: # Both empty +"quoted key": + - entry + +================================================================================ +`; + exports[`spec-example-8-19-compact-block-mappings.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7408,6 +11120,25 @@ useTabs: true ================================================================================ `; +exports[`spec-example-8-19-compact-block-mappings.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- sun: yellow +- ? earth: blue + : moon: white + +=====================================output===================================== +- sun: yellow +- ? earth: blue + : moon: white + +================================================================================ +`; + exports[`spec-example-8-20-block-node-types.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7426,7 +11157,8 @@ proseWrap: "always" - "flow in block" - > Block scalar -- !!map # Block collection +- !!map + # Block collection foo: bar ================================================================================ @@ -7450,7 +11182,33 @@ useTabs: true - "flow in block" - > Block scalar +- !!map + # Block collection + foo: bar + +================================================================================ +`; + +exports[`spec-example-8-20-block-node-types.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- + "flow in block" +- > + Block scalar - !!map # Block collection + foo : bar + +=====================================output===================================== +- "flow in block" +- > + Block scalar +- !!map + # Block collection foo: bar ================================================================================ @@ -7502,6 +11260,29 @@ folded: !foo >1 ================================================================================ `; +exports[`spec-example-8-21-block-scalar-nodes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +literal: |2 + value +folded: + !foo + >1 + value + +=====================================output===================================== +literal: |2 + value +folded: !foo >1 + value + +================================================================================ +`; + exports[`spec-example-8-22-block-collection-nodes.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7552,6 +11333,31 @@ mapping: !!map ================================================================================ `; +exports[`spec-example-8-22-block-collection-nodes.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +sequence: !!seq +- entry +- !!seq + - nested +mapping: !!map + foo: bar + +=====================================output===================================== +sequence: !!seq + - entry + - !!seq + - nested +mapping: !!map + foo: bar + +================================================================================ +`; + exports[`spec-example-9-2-document-markers.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7586,19 +11392,66 @@ Document ... # Suffix =====================================output===================================== -%YAML 1.2 +%YAML 1.2 +--- +Document +... # Suffix + +================================================================================ +`; + +exports[`spec-example-9-2-document-markers.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +%YAML 1.2 +--- +Document +... # Suffix + +=====================================output===================================== +%YAML 1.2 +--- +Document +... # Suffix + +================================================================================ +`; + +exports[`spec-example-9-3-bare-documents.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +Bare +document +... +# No document +... +| +%!PS-Adobe-2.0 # Not the first line + +=====================================output===================================== +Bare document --- -Document -... # Suffix +# No document +--- +| + %!PS-Adobe-2.0 # Not the first line ================================================================================ `; -exports[`spec-example-9-3-bare-documents.yml - {"proseWrap":"always"} format 1`] = ` +exports[`spec-example-9-3-bare-documents.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== Bare @@ -7610,7 +11463,8 @@ document %!PS-Adobe-2.0 # Not the first line =====================================output===================================== -Bare document +Bare +document --- # No document --- @@ -7620,11 +11474,11 @@ Bare document ================================================================================ `; -exports[`spec-example-9-3-bare-documents.yml - {"useTabs":true} format 1`] = ` +exports[`spec-example-9-3-bare-documents.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== Bare @@ -7697,6 +11551,32 @@ useTabs: true ================================================================================ `; +exports[`spec-example-9-4-explicit-documents.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- +{ matches +% : 20 } +... +--- +# Empty +... + +=====================================output===================================== +--- +{ ? matches + % + : 20 } +--- +# Empty + +================================================================================ +`; + exports[`spec-example-9-5-directives-documents.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7755,6 +11635,35 @@ useTabs: true ================================================================================ `; +exports[`spec-example-9-5-directives-documents.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +%YAML 1.2 +--- | +%!PS-Adobe-2.0 +... +%YAML1.2 +--- +# Empty +... + +=====================================output===================================== +%YAML 1.2 +--- +| + %!PS-Adobe-2.0 +... +%YAML1.2 +--- +# Empty + +================================================================================ +`; + exports[`spec-example-9-6-stream.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7809,6 +11718,33 @@ matches %: 20 ================================================================================ `; +exports[`spec-example-9-6-stream.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +Document +--- +# Empty +... +%YAML 1.2 +--- +matches %: 20 + +=====================================output===================================== +Document +--- +# Empty +... +%YAML 1.2 +--- +matches %: 20 + +================================================================================ +`; + exports[`tab-after-document-header.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7841,6 +11777,22 @@ scalar ================================================================================ `; +exports[`tab-after-document-header.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- scalar + +=====================================output===================================== +--- +scalar + +================================================================================ +`; + exports[`tab-at-beginning-of-line-followed-by-a-flow-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7871,6 +11823,21 @@ useTabs: true ================================================================================ `; +exports[`tab-at-beginning-of-line-followed-by-a-flow-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== + {} + +=====================================output===================================== +{} + +================================================================================ +`; + exports[`tags-for-block-objects.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7913,6 +11880,27 @@ foo: !!seq ================================================================================ `; +exports[`tags-for-block-objects.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +foo: !!seq + - !!str a + - !!map + key: !!str value + +=====================================output===================================== +foo: !!seq + - !!str a + - !!map + key: !!str value + +================================================================================ +`; + exports[`tags-for-flow-objects.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -7949,6 +11937,24 @@ useTabs: true ================================================================================ `; +exports[`tags-for-flow-objects.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!map { + k: !!seq + [ a, !!str b] +} + +=====================================output===================================== +!!map { k: !!seq [a, !!str b] } + +================================================================================ +`; + exports[`tags-for-root-objects.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8008,6 +12014,36 @@ e ================================================================================ `; +exports[`tags-for-root-objects.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- !!map +? a +: b +--- !!seq +- !!str c +--- !!str +d +e + +=====================================output===================================== +--- +!!map +a: b +--- +!!seq +- !!str c +--- +!!str d +e + +================================================================================ +`; + exports[`tags-in-block-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8050,6 +12086,27 @@ useTabs: true ================================================================================ `; +exports[`tags-in-block-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== + - !!str a + - b + - !!int 42 + - d + +=====================================output===================================== +- !!str a +- b +- !!int 42 +- d + +================================================================================ +`; + exports[`tags-in-explicit-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8088,6 +12145,25 @@ c: !!str d ================================================================================ `; +exports[`tags-in-explicit-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +? !!str a +: !!int 47 +? c +: !!str d + +=====================================output===================================== +!!str a: !!int 47 +c: !!str d + +================================================================================ +`; + exports[`tags-in-implicit-mapping.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8134,11 +12210,56 @@ g: h ================================================================================ `; -exports[`tags-on-empty-scalars.yml - {"proseWrap":"always"} format 1`] = ` +exports[`tags-in-implicit-mapping.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +!!str a: b +c: !!int 42 +e: !!str f +g: h +!!int 23: !!bool false + +=====================================output===================================== +!!str a: b +c: !!int 42 +e: !!str f +g: h +!!int 23: !!bool false + +================================================================================ +`; + +exports[`tags-on-empty-scalars.yml - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +- !!str +- + !!null : a + b: !!str +- !!str : !!null + +=====================================output===================================== +- !!str +- !!null : a + b: !!str +- !!str : !!null + +================================================================================ +`; + +exports[`tags-on-empty-scalars.yml - {"useTabs":true} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -proseWrap: "always" +useTabs: true | printWidth =====================================input====================================== - !!str @@ -8156,11 +12277,11 @@ proseWrap: "always" ================================================================================ `; -exports[`tags-on-empty-scalars.yml - {"useTabs":true} format 1`] = ` +exports[`tags-on-empty-scalars.yml - {"yamlBreakBeforeComment":false} format 1`] = ` ====================================options===================================== parsers: ["yaml"] printWidth: 80 -useTabs: true +yamlBreakBeforeComment: false | printWidth =====================================input====================================== - !!str @@ -8211,6 +12332,23 @@ word2 ================================================================================ `; +exports[`three-dashes-and-content-without-space.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +---word1 +word2 + +=====================================output===================================== +---word1 +word2 + +================================================================================ +`; + exports[`various-combinations-of-tags-and-anchors.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8329,6 +12467,65 @@ a6: 1 ================================================================================ `; +exports[`various-combinations-of-tags-and-anchors.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`various-location-of-anchors-in-flow-sequence.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8369,6 +12566,26 @@ useTabs: true ================================================================================ `; +exports[`various-location-of-anchors-in-flow-sequence.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`various-trailing-comments.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8403,7 +12620,8 @@ c: #lala : # lala - #lala seq2 -e: &node # lala +e: &node + # lala - x: y block: > # lala abcde @@ -8447,7 +12665,53 @@ c: #lala : # lala - #lala seq2 -e: &node # lala +e: &node + # lala + - x: y +block: > # lala + abcde + +================================================================================ +`; + +exports[`various-trailing-comments.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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 @@ -8497,6 +12761,27 @@ c: d #X ================================================================================ `; +exports[`various-trailing-tabs.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +a: b +seq: + - a +c: d #X + +=====================================output===================================== +a: b +seq: + - a +c: d #X + +================================================================================ +`; + exports[`whitespace-after-scalars-in-flow.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8541,6 +12826,28 @@ useTabs: true ================================================================================ `; +exports[`whitespace-after-scalars-in-flow.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +- [a, b , c ] +- { "a" : b + , c : 'd' , + e : "f" + } +- [ ] + +=====================================output===================================== +- [a, b, c] +- { "a": b, c: "d", e: "f" } +- [] + +================================================================================ +`; + exports[`whitespace-around-colon-in-mappings.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8613,6 +12920,42 @@ top6: ================================================================================ `; +exports[`whitespace-around-colon-in-mappings.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | 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[`zero-indented-block-scalar.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8655,6 +12998,28 @@ line3 ================================================================================ `; +exports[`zero-indented-block-scalar.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- > +line1 +line2 +line3 + +=====================================output===================================== +--- +> + line1 + line2 + line3 + +================================================================================ +`; + exports[`zero-indented-block-scalar-with-line-that-looks-like-a-comment.yml - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["yaml"] @@ -8696,3 +13061,25 @@ line3 ================================================================================ `; + +exports[`zero-indented-block-scalar-with-line-that-looks-like-a-comment.yml - {"yamlBreakBeforeComment":false} format 1`] = ` +====================================options===================================== +parsers: ["yaml"] +printWidth: 80 +yamlBreakBeforeComment: false + | printWidth +=====================================input====================================== +--- > +line1 +# no comment +line3 + +=====================================output===================================== +--- +> + line1 + # no comment + line3 + +================================================================================ +`; diff --git a/tests/format/yaml/spec/jsfmt.spec.js b/tests/format/yaml/spec/jsfmt.spec.js index 0d5398694a..f2e5f5cc48 100644 --- a/tests/format/yaml/spec/jsfmt.spec.js +++ b/tests/format/yaml/spec/jsfmt.spec.js @@ -1,2 +1,4 @@ run_spec(__dirname, ["yaml"], { useTabs: true }); run_spec(__dirname, ["yaml"], { proseWrap: "always" }); +// support --no-yaml-break-before-comment +run_spec(__dirname, ["yaml"], { yamlBreakBeforeComment: false }); diff --git a/tests/integration/__tests__/__snapshots__/early-exit.js.snap b/tests/integration/__tests__/__snapshots__/early-exit.js.snap index 780c362064..a95114bf5f 100644 --- a/tests/integration/__tests__/__snapshots__/early-exit.js.snap +++ b/tests/integration/__tests__/__snapshots__/early-exit.js.snap @@ -148,6 +148,8 @@ Format options: Defaults to false. --no-yaml-bracket-spacing Do not put spaces between brackets / curly braces for YAML. + --no-yaml-break-before-comment + Do not put line break before comment section for YAML. --yield-star-spacing Put spaces around the star (\`*\`) in \`yield*\` expressions (before and after - similar to the corresponding eslint option). (Default is after only.) Defaults to false. @@ -365,6 +367,8 @@ Format options: Defaults to false. --no-yaml-bracket-spacing Do not put spaces between brackets / curly braces for YAML. + --no-yaml-break-before-comment + Do not put line break before comment section for YAML. --yield-star-spacing Put spaces around the star (\`*\`) in \`yield*\` expressions (before and after - similar to the corresponding eslint option). (Default is after only.) Defaults to false. diff --git a/tests/integration/__tests__/__snapshots__/help-options.js.snap b/tests/integration/__tests__/__snapshots__/help-options.js.snap index f3cf49b838..e1dc5aaa47 100644 --- a/tests/integration/__tests__/__snapshots__/help-options.js.snap +++ b/tests/integration/__tests__/__snapshots__/help-options.js.snap @@ -596,6 +596,17 @@ exports[`show detailed usage with --help no-yaml-bracket-spacing (stdout) 1`] = exports[`show detailed usage with --help no-yaml-bracket-spacing (write) 1`] = `Array []`; +exports[`show detailed usage with --help no-yaml-break-before-comment (stderr) 1`] = `""`; + +exports[`show detailed usage with --help no-yaml-break-before-comment (stdout) 1`] = ` +"--no-yaml-break-before-comment + + Do not put line break before comment section for YAML. +" +`; + +exports[`show detailed usage with --help no-yaml-break-before-comment (write) 1`] = `Array []`; + exports[`show detailed usage with --help object-curly-spacing (stderr) 1`] = `""`; exports[`show detailed usage with --help object-curly-spacing (stdout) 1`] = ` @@ -1024,6 +1035,19 @@ Default: true exports[`show detailed usage with --help yaml-bracket-spacing (write) 1`] = `Array []`; +exports[`show detailed usage with --help yaml-break-before-comment (stderr) 1`] = `""`; + +exports[`show detailed usage with --help yaml-break-before-comment (stdout) 1`] = ` +"--yaml-break-before-comment + + Put or remove line breaked before comment section for YAML. + +Default: false +" +`; + +exports[`show detailed usage with --help yaml-break-before-comment (write) 1`] = `Array []`; + exports[`show detailed usage with --help yield-star-spacing (stderr) 1`] = `""`; exports[`show detailed usage with --help yield-star-spacing (stdout) 1`] = ` diff --git a/tests/integration/__tests__/__snapshots__/schema.js.snap b/tests/integration/__tests__/__snapshots__/schema.js.snap index 2cae4aa622..3619261677 100644 --- a/tests/integration/__tests__/__snapshots__/schema.js.snap +++ b/tests/integration/__tests__/__snapshots__/schema.js.snap @@ -533,6 +533,11 @@ in order for it to be formatted.", "description": "Put spaces between brackets / curly braces for YAML.", "type": "boolean", }, + "yamlBreakBeforeComment": Object { + "default": false, + "description": "Put or remove line breaked before comment section for YAML.", + "type": "boolean", + }, "yieldStarSpacing": Object { "default": false, "description": "Put spaces around the star (\`*\`) in \`yield*\` expressions (before and after - similar to the corresponding eslint option). (Default is after only.)", diff --git a/tests/integration/__tests__/__snapshots__/support-info.js.snap b/tests/integration/__tests__/__snapshots__/support-info.js.snap index b811510acf..10b9730dc4 100644 --- a/tests/integration/__tests__/__snapshots__/support-info.js.snap +++ b/tests/integration/__tests__/__snapshots__/support-info.js.snap @@ -361,6 +361,10 @@ Object { "default": true, "type": "boolean", }, + "yamlBreakBeforeComment": Object { + "default": false, + "type": "boolean", + }, "yieldStarSpacing": Object { "default": false, "type": "boolean", @@ -1406,6 +1410,15 @@ exports[`CLI --support-info (stdout) 1`] = ` \\"pluginDefaults\\": {}, \\"type\\": \\"boolean\\" }, + { + \\"category\\": \\"Other\\", + \\"default\\": false, + \\"description\\": \\"Put or remove line breaked before comment section for YAML.\\", + \\"name\\": \\"yamlBreakBeforeComment\\", + \\"oppositeDescription\\": \\"Do not put line break before comment section for YAML.\\", + \\"pluginDefaults\\": {}, + \\"type\\": \\"boolean\\" + }, { \\"category\\": \\"JavaScript\\", \\"default\\": false,