| author | |
| committer | |
| log | d6455008830eff433a14c5eff6094f2f5ba9991d |
| tree | 4ea2109b54cc4a0800e6aa685913d1ad78001c2f |
| parent | 0563e8e1d4181a2707a1898941ccf59d974bc835 |
2 files changed, 16 insertions(+), 3 deletions(-)
std/zig/parser_test.zig+13| ... | ... | @@ -1027,6 +1027,19 @@ test "zig fmt: line comments in struct initializer" { |
| 1027 | 1027 | ); |
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | test "zig fmt: first line comment in struct initializer" { | |
| 1031 | try testCanonical( | |
| 1032 | \\pub async fn acquire(self: *Self) HeldLock { | |
| 1033 | \\ return HeldLock{ | |
| 1034 | \\ // TODO guaranteed allocation elision | |
| 1035 | \\ .held = await (async self.lock.acquire() catch unreachable), | |
| 1036 | \\ .value = &self.private_data, | |
| 1037 | \\ }; | |
| 1038 | \\} | |
| 1039 | \\ | |
| 1040 | ); | |
| 1041 | } | |
| 1042 | ||
| 1030 | 1043 | test "zig fmt: doc comments before struct field" { |
| 1031 | 1044 | try testCanonical( |
| 1032 | 1045 | \\pub const Allocator = struct { |
std/zig/render.zig+3-3| ... | ... | @@ -658,11 +658,11 @@ fn renderExpression( |
| 658 | 658 | return renderToken(tree, stream, suffix_op.rtoken, indent, start_col, space); |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | try renderExpression(allocator, stream, tree, indent, start_col, suffix_op.lhs, Space.None); | |
| 662 | try renderToken(tree, stream, lbrace, indent, start_col, Space.Newline); | |
| 663 | ||
| 664 | 661 | const new_indent = indent + indent_delta; |
| 665 | 662 | |
| 663 | try renderExpression(allocator, stream, tree, new_indent, start_col, suffix_op.lhs, Space.None); | |
| 664 | try renderToken(tree, stream, lbrace, new_indent, start_col, Space.Newline); | |
| 665 | ||
| 666 | 666 | var it = field_inits.iterator(0); |
| 667 | 667 | while (it.next()) |field_init| { |
| 668 | 668 | try stream.writeByteNTimes(' ', new_indent); |