Commit a005b5f198

Andrew Kelley <andrew@ziglang.org>
2023-02-18 17:24:25
add zig fmt test for upgrading for loop syntax
1 parent aeaef8c
Changed files (1)
lib
lib/std/zig/parser_test.zig
@@ -1,3 +1,23 @@
+// TODO: remove this after zig 0.11.0 is released
+test "zig fmt: transform old for loop syntax to new" {
+    try testTransform(
+        \\fn foo() void {
+        \\    for (a) |b, i| {
+        \\        _ = b; _ = i;
+        \\    }
+        \\}
+        \\
+    ,
+        \\fn foo() void {
+        \\    for (a, 0..) |b, i| {
+        \\        _ = b;
+        \\        _ = i;
+        \\    }
+        \\}
+        \\
+    );
+}
+
 test "zig fmt: tuple struct" {
     try testCanonical(
         \\const T = struct {