Files
test-repo/tests/format/yaml/block-value/format.test.js
T
fisker Cheungandautofix-ci[bot] 3149f353d7 Enable unicorn/prefer-string-repeat rule (#19306)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-06-08 18:16:28 +08:00

28 lines
712 B
JavaScript

const blockStyles = ["|", ">", "|+", "|-", ">+", ">-"];
const trailingSpace = ["", " ".repeat(3), " \t"];
const newlines = ["", "\n", "\n\n", "\n".repeat(3)];
const snippets = blockStyles.flatMap((blockStyle) =>
trailingSpace.flatMap((space) =>
newlines.flatMap((lines) =>
[
`foo: ${blockStyle}\n${lines}`,
// `foo: ${blockStyle}\n ${space}${lines}`,
`foo: ${blockStyle}\n x\n${lines}`,
`foo: ${blockStyle}\n x\n${space}\n${lines}`,
].flatMap((code) => [code, `${code}\n...`]),
),
),
);
runFormatTest(
{
importMeta: import.meta,
snippets: snippets.map((code) => ({
name: JSON.stringify(code),
code,
})),
},
["yaml"],
);