zig fmt: multiline string literals + array init
This commit is contained in:
@@ -3986,68 +3986,71 @@ test "zig fmt: allow trailing line comments to do manual array formatting" {
|
||||
);
|
||||
}
|
||||
|
||||
//test "zig fmt: multiline string literals should play nice with array initializers" {
|
||||
// try testCanonical(
|
||||
// \\fn main() void {
|
||||
// \\ var a = .{.{.{.{.{.{.{.{
|
||||
// \\ 0,
|
||||
// \\ }}}}}}}};
|
||||
// \\ myFunc(.{
|
||||
// \\ "aaaaaaa", "bbbbbb", "ccccc",
|
||||
// \\ "dddd", ("eee"), ("fff"),
|
||||
// \\ ("gggg"),
|
||||
// \\ // Line comment
|
||||
// \\ \\Multiline String Literals can be quite long
|
||||
// \\ ,
|
||||
// \\ \\Multiline String Literals can be quite long
|
||||
// \\ \\Multiline String Literals can be quite long
|
||||
// \\ ,
|
||||
// \\ \\Multiline String Literals can be quite long
|
||||
// \\ \\Multiline String Literals can be quite long
|
||||
// \\ \\Multiline String Literals can be quite long
|
||||
// \\ \\Multiline String Literals can be quite long
|
||||
// \\ ,
|
||||
// \\ (
|
||||
// \\ \\Multiline String Literals can be quite long
|
||||
// \\ ),
|
||||
// \\ .{
|
||||
// \\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// \\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// \\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// \\ },
|
||||
// \\ .{(
|
||||
// \\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// \\ )},
|
||||
// \\ .{
|
||||
// \\ "xxxxxxx", "xxx",
|
||||
// \\ (
|
||||
// \\ \\ xxx
|
||||
// \\ ),
|
||||
// \\ "xxx", "xxx",
|
||||
// \\ },
|
||||
// \\ .{ "xxxxxxx", "xxx", "xxx", "xxx" }, .{ "xxxxxxx", "xxx", "xxx", "xxx" },
|
||||
// \\ "aaaaaaa", "bbbbbb", "ccccc", // -
|
||||
// \\ "dddd", ("eee"), ("fff"),
|
||||
// \\ .{
|
||||
// \\ "xxx", "xxx",
|
||||
// \\ (
|
||||
// \\ \\ xxx
|
||||
// \\ ),
|
||||
// \\ "xxxxxxxxxxxxxx", "xxx",
|
||||
// \\ },
|
||||
// \\ .{
|
||||
// \\ (
|
||||
// \\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// \\ ),
|
||||
// \\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// \\ },
|
||||
// \\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// \\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// \\ });
|
||||
// \\}
|
||||
// \\
|
||||
// );
|
||||
//}
|
||||
test "zig fmt: multiline string literals should play nice with array initializers" {
|
||||
try testCanonical(
|
||||
\\fn main() void {
|
||||
\\ var a = .{.{.{.{.{.{.{.{
|
||||
\\ 0,
|
||||
\\ }}}}}}}};
|
||||
\\ myFunc(.{
|
||||
\\ "aaaaaaa", "bbbbbb", "ccccc",
|
||||
\\ "dddd", ("eee"), ("fff"),
|
||||
\\ ("gggg"),
|
||||
\\ // Line comment
|
||||
\\ \\Multiline String Literals can be quite long
|
||||
\\ ,
|
||||
\\ \\Multiline String Literals can be quite long
|
||||
\\ \\Multiline String Literals can be quite long
|
||||
\\ ,
|
||||
\\ \\Multiline String Literals can be quite long
|
||||
\\ \\Multiline String Literals can be quite long
|
||||
\\ \\Multiline String Literals can be quite long
|
||||
\\ \\Multiline String Literals can be quite long
|
||||
\\ ,
|
||||
\\ (
|
||||
\\ \\Multiline String Literals can be quite long
|
||||
\\ ),
|
||||
\\ .{
|
||||
\\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
\\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
\\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
\\ },
|
||||
\\ .{(
|
||||
\\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
\\ )},
|
||||
\\ .{
|
||||
\\ "xxxxxxx", "xxx",
|
||||
\\ (
|
||||
\\ \\ xxx
|
||||
\\ ),
|
||||
\\ "xxx",
|
||||
\\ "xxx",
|
||||
\\ },
|
||||
\\ .{ "xxxxxxx", "xxx", "xxx", "xxx" },
|
||||
\\ .{ "xxxxxxx", "xxx", "xxx", "xxx" },
|
||||
\\ "aaaaaaa", "bbbbbb", "ccccc", // -
|
||||
\\ "dddd", ("eee"), ("fff"),
|
||||
\\ .{
|
||||
\\ "xxx", "xxx",
|
||||
\\ (
|
||||
\\ \\ xxx
|
||||
\\ ),
|
||||
\\ "xxxxxxxxxxxxxx",
|
||||
\\ "xxx",
|
||||
\\ },
|
||||
\\ .{
|
||||
\\ (
|
||||
\\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
\\ ),
|
||||
\\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
\\ },
|
||||
\\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
\\ \\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
\\ });
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: use of comments and multiline string literals may force the parameters over multiple lines" {
|
||||
try testCanonical(
|
||||
|
||||
Reference in New Issue
Block a user