add zig fmt test for upgrading for loop syntax

This commit is contained in:
Andrew Kelley 2023-02-18 09:24:25 -07:00
parent aeaef8c0ff
commit a005b5f198

View File

@ -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 {