authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-18 09:24:25-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-18 19:17:21-07:00
loga005b5f198827b15ee069839fb9dbb80e66daa06
treed870ea5800edfd9a615d5992f51d986a592e2351
parentaeaef8c0ffadab4145fd002f2edd87a6db66ebd1

add zig fmt test for upgrading for loop syntax


1 files changed, 20 insertions(+), 0 deletions(-)

lib/std/zig/parser_test.zig+20
...@@ -1,3 +1,23 @@...@@ -1,3 +1,23 @@
1// TODO: remove this after zig 0.11.0 is released
2test "zig fmt: transform old for loop syntax to new" {
3 try testTransform(
4 \\fn foo() void {
5 \\ for (a) |b, i| {
6 \\ _ = b; _ = i;
7 \\ }
8 \\}
9 \\
10 ,
11 \\fn foo() void {
12 \\ for (a, 0..) |b, i| {
13 \\ _ = b;
14 \\ _ = i;
15 \\ }
16 \\}
17 \\
18 );
19}
20
1test "zig fmt: tuple struct" {21test "zig fmt: tuple struct" {
2 try testCanonical(22 try testCanonical(
3 \\const T = struct {23 \\const T = struct {