zig fmt: remove trailing whitespace on doc comments
Fixes #11353 The renderer treats comments and doc comments differently since doc comments are parsed into the Ast. This commit adds a check after getting the text for the doc comment and trims whitespace at the end before rendering. The `a = 0,` in the test is here to avoid a ParseError while parsing the test.
This commit is contained in:
@@ -4712,6 +4712,28 @@ test "zig fmt: space after top level doc comment" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: remove trailing whitespace after container doc comment" {
|
||||
try testTransform(
|
||||
\\//! top level doc comment
|
||||
\\
|
||||
,
|
||||
\\//! top level doc comment
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: remove trailing whitespace after doc comment" {
|
||||
try testTransform(
|
||||
\\/// doc comment
|
||||
\\a = 0,
|
||||
\\
|
||||
,
|
||||
\\/// doc comment
|
||||
\\a = 0,
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: for loop with ptr payload and index" {
|
||||
try testCanonical(
|
||||
\\test {
|
||||
|
||||
Reference in New Issue
Block a user