zig fmt: fix idempotency with newlines surrounding doc comment
Fixes: https://github.com/ziglang/zig/issues/11802
This commit is contained in:
@@ -4154,6 +4154,41 @@ test "zig fmt: container doc comments" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: remove newlines surrounding doc comment" {
|
||||
try testTransform(
|
||||
\\
|
||||
\\
|
||||
\\
|
||||
\\/// doc comment
|
||||
\\
|
||||
\\fn foo() void {}
|
||||
\\
|
||||
,
|
||||
\\/// doc comment
|
||||
\\fn foo() void {}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: remove newlines surrounding doc comment within container decl" {
|
||||
try testTransform(
|
||||
\\const Foo = struct {
|
||||
\\
|
||||
\\
|
||||
\\ /// doc comment
|
||||
\\
|
||||
\\ fn foo() void {}
|
||||
\\};
|
||||
\\
|
||||
,
|
||||
\\const Foo = struct {
|
||||
\\ /// doc comment
|
||||
\\ fn foo() void {}
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: anytype struct field" {
|
||||
try testError(
|
||||
\\pub const Pointer = struct {
|
||||
|
||||
Reference in New Issue
Block a user