diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig index b38e4c6ea9..7338122afc 100644 --- a/lib/std/zig/parser_test.zig +++ b/lib/std/zig/parser_test.zig @@ -2703,28 +2703,28 @@ test "zig fmt: catch" { ); } -//test "zig fmt: blocks" { -// try testCanonical( -// \\test "blocks" { -// \\ { -// \\ const a = 0; -// \\ const b = 0; -// \\ } -// \\ -// \\ blk: { -// \\ const a = 0; -// \\ const b = 0; -// \\ } -// \\ -// \\ const r = blk: { -// \\ const a = 0; -// \\ const b = 0; -// \\ }; -// \\} -// \\ -// ); -//} -// +test "zig fmt: blocks" { + try testCanonical( + \\test "blocks" { + \\ { + \\ const a = 0; + \\ const b = 0; + \\ } + \\ + \\ blk: { + \\ const a = 0; + \\ const b = 0; + \\ } + \\ + \\ const r = blk: { + \\ const a = 0; + \\ const b = 0; + \\ }; + \\} + \\ + ); +} + //test "zig fmt: switch" { // try testCanonical( // \\test "switch" { diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index 7daf1b7a62..f67c95d355 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -1768,8 +1768,8 @@ fn renderBlock( return renderToken(ais, tree, lbrace + 1, space); // rbrace } - ais.pushIndent(); try renderToken(ais, tree, lbrace, .Newline); + ais.pushIndent(); for (statements) |stmt, i| { switch (node_tags[stmt]) { .GlobalVarDecl => try renderVarDecl(ais, tree, tree.globalVarDecl(stmt)),