| ... | @@ -3392,6 +3392,43 @@ test "zig fmt: Indent comma correctly after multiline string literals in arg lis | ... | @@ -3392,6 +3392,43 @@ test "zig fmt: Indent comma correctly after multiline string literals in arg lis |
| 3392 | ); | 3392 | ); |
| 3393 | } | 3393 | } |
| 3394 | | 3394 | |
| | 3395 | test "zig fmt: Control flow statement as body of blockless if" { |
| | 3396 | try testCanonical( |
| | 3397 | \\pub fn main() void { |
| | 3398 | \\ const zoom_node = if (focused_node == layout_first) |
| | 3399 | \\ if (it.next()) { |
| | 3400 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| | 3401 | \\ } else null |
| | 3402 | \\ else |
| | 3403 | \\ focused_node; |
| | 3404 | \\ |
| | 3405 | \\ const zoom_node = if (focused_node == layout_first) while (it.next()) |node| { |
| | 3406 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| | 3407 | \\ } else null else |
| | 3408 | \\ focused_node; |
| | 3409 | \\ |
| | 3410 | \\ const zoom_node = if (focused_node == layout_first) |
| | 3411 | \\ if (it.next()) { |
| | 3412 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| | 3413 | \\ } else null; |
| | 3414 | \\ |
| | 3415 | \\ const zoom_node = if (focused_node == layout_first) while (it.next()) |node| { |
| | 3416 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| | 3417 | \\ }; |
| | 3418 | \\ |
| | 3419 | \\ const zoom_node = if (focused_node == layout_first) for (nodes) |node| { |
| | 3420 | \\ break node; |
| | 3421 | \\ }; |
| | 3422 | \\ |
| | 3423 | \\ const zoom_node = if (focused_node == layout_first) switch (nodes) { |
| | 3424 | \\ 0 => 0, |
| | 3425 | \\ } else |
| | 3426 | \\ focused_node; |
| | 3427 | \\} |
| | 3428 | \\ |
| | 3429 | ); |
| | 3430 | } |
| | 3431 | |
| 3395 | const std = @import("std"); | 3432 | const std = @import("std"); |
| 3396 | const mem = std.mem; | 3433 | const mem = std.mem; |
| 3397 | const warn = std.debug.warn; | 3434 | const warn = std.debug.warn; |