zig fmt: Resolve #11131 loss of comment on switch cases
Correct switch cases dropping comments in certain situations by checking for the presence of the comment before collapsing to one line.
This commit is contained in:
committed by
GitHub
parent
5ea94e7715
commit
3bb4c0c789
@@ -1791,6 +1791,19 @@ test "zig fmt: switch comment before prong" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: switch comment after prong" {
|
||||
try testCanonical(
|
||||
\\comptime {
|
||||
\\ switch (a) {
|
||||
\\ 0,
|
||||
\\ // hi
|
||||
\\ => {},
|
||||
\\ }
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: struct literal no trailing comma" {
|
||||
try testTransform(
|
||||
\\const a = foo{ .x = 1, .y = 2 };
|
||||
|
||||
Reference in New Issue
Block a user