| ... | @@ -3726,22 +3726,22 @@ test "zig fmt: C var args" { | ... | @@ -3726,22 +3726,22 @@ test "zig fmt: C var args" { |
| 3726 | ); | 3726 | ); |
| 3727 | } | 3727 | } |
| 3728 | | 3728 | |
| 3729 | //test "zig fmt: Only indent multiline string literals in function calls" { | 3729 | test "zig fmt: Only indent multiline string literals in function calls" { |
| 3730 | // try testCanonical( | 3730 | try testCanonical( |
| 3731 | // \\test "zig fmt:" { | 3731 | \\test "zig fmt:" { |
| 3732 | // \\ try testTransform( | 3732 | \\ try testTransform( |
| 3733 | // \\ \\const X = struct { | 3733 | \\ \\const X = struct { |
| 3734 | // \\ \\ foo: i32, bar: i8 }; | 3734 | \\ \\ foo: i32, bar: i8 }; |
| 3735 | // \\ , | 3735 | \\ , |
| 3736 | // \\ \\const X = struct { | 3736 | \\ \\const X = struct { |
| 3737 | // \\ \\ foo: i32, bar: i8 | 3737 | \\ \\ foo: i32, bar: i8 |
| 3738 | // \\ \\}; | 3738 | \\ \\}; |
| 3739 | // \\ \\ | 3739 | \\ \\ |
| 3740 | // \\ ); | 3740 | \\ ); |
| 3741 | // \\} | 3741 | \\} |
| 3742 | // \\ | 3742 | \\ |
| 3743 | // ); | 3743 | ); |
| 3744 | //} | 3744 | } |
| 3745 | | 3745 | |
| 3746 | test "zig fmt: Don't add extra newline after if" { | 3746 | test "zig fmt: Don't add extra newline after if" { |
| 3747 | try testCanonical( | 3747 | try testCanonical( |
| ... | @@ -3806,68 +3806,66 @@ test "zig fmt: comments in ternary ifs" { | ... | @@ -3806,68 +3806,66 @@ test "zig fmt: comments in ternary ifs" { |
| 3806 | // \\ | 3806 | // \\ |
| 3807 | // ); | 3807 | // ); |
| 3808 | //} | 3808 | //} |
| 3809 | // | | |
| 3810 | //test "zig fmt: Indent comma correctly after multiline string literals in arg list (trailing comma)" { | | |
| 3811 | // try testCanonical( | | |
| 3812 | // \\fn foo() void { | | |
| 3813 | // \\ z.display_message_dialog( | | |
| 3814 | // \\ *const [323:0]u8, | | |
| 3815 | // \\ \\Message Text | | |
| 3816 | // \\ \\------------ | | |
| 3817 | // \\ \\xxxxxxxxxxxx | | |
| 3818 | // \\ \\xxxxxxxxxxxx | | |
| 3819 | // \\ , | | |
| 3820 | // \\ g.GtkMessageType.GTK_MESSAGE_WARNING, | | |
| 3821 | // \\ null, | | |
| 3822 | // \\ ); | | |
| 3823 | // \\ | | |
| 3824 | // \\ z.display_message_dialog(*const [323:0]u8, | | |
| 3825 | // \\ \\Message Text | | |
| 3826 | // \\ \\------------ | | |
| 3827 | // \\ \\xxxxxxxxxxxx | | |
| 3828 | // \\ \\xxxxxxxxxxxx | | |
| 3829 | // \\ , g.GtkMessageType.GTK_MESSAGE_WARNING, null); | | |
| 3830 | // \\} | | |
| 3831 | // \\ | | |
| 3832 | // ); | | |
| 3833 | //} | | |
| 3834 | | 3809 | |
| 3835 | //test "zig fmt: Control flow statement as body of blockless if" { | 3810 | test "zig fmt: Indent comma correctly after multiline string literals in arg list (trailing comma)" { |
| 3836 | // try testCanonical( | 3811 | try testCanonical( |
| 3837 | // \\pub fn main() void { | 3812 | \\fn foo() void { |
| 3838 | // \\ const zoom_node = if (focused_node == layout_first) | 3813 | \\ z.display_message_dialog( |
| 3839 | // \\ if (it.next()) { | 3814 | \\ *const [323:0]u8, |
| 3840 | // \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; | 3815 | \\ \\Message Text |
| 3841 | // \\ } else null | 3816 | \\ \\------------ |
| 3842 | // \\ else | 3817 | \\ \\xxxxxxxxxxxx |
| 3843 | // \\ focused_node; | 3818 | \\ \\xxxxxxxxxxxx |
| 3844 | // \\ | 3819 | \\ , |
| 3845 | // \\ const zoom_node = if (focused_node == layout_first) while (it.next()) |node| { | 3820 | \\ g.GtkMessageType.GTK_MESSAGE_WARNING, |
| 3846 | // \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; | 3821 | \\ null, |
| 3847 | // \\ } else null else | 3822 | \\ ); |
| 3848 | // \\ focused_node; | 3823 | \\ |
| 3849 | // \\ | 3824 | \\ z.display_message_dialog(*const [323:0]u8, |
| 3850 | // \\ const zoom_node = if (focused_node == layout_first) | 3825 | \\ \\Message Text |
| 3851 | // \\ if (it.next()) { | 3826 | \\ \\------------ |
| 3852 | // \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; | 3827 | \\ \\xxxxxxxxxxxx |
| 3853 | // \\ } else null; | 3828 | \\ \\xxxxxxxxxxxx |
| 3854 | // \\ | 3829 | \\ , g.GtkMessageType.GTK_MESSAGE_WARNING, null); |
| 3855 | // \\ const zoom_node = if (focused_node == layout_first) while (it.next()) |node| { | 3830 | \\} |
| 3856 | // \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; | 3831 | \\ |
| 3857 | // \\ }; | 3832 | ); |
| 3858 | // \\ | 3833 | } |
| 3859 | // \\ const zoom_node = if (focused_node == layout_first) for (nodes) |node| { | 3834 | |
| 3860 | // \\ break node; | 3835 | test "zig fmt: Control flow statement as body of blockless if" { |
| 3861 | // \\ }; | 3836 | try testCanonical( |
| 3862 | // \\ | 3837 | \\pub fn main() void { |
| 3863 | // \\ const zoom_node = if (focused_node == layout_first) switch (nodes) { | 3838 | \\ const zoom_node = if (focused_node == layout_first) |
| 3864 | // \\ 0 => 0, | 3839 | \\ if (it.next()) { |
| 3865 | // \\ } else | 3840 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| 3866 | // \\ focused_node; | 3841 | \\ } else null |
| 3867 | // \\} | 3842 | \\ else |
| 3868 | // \\ | 3843 | \\ focused_node; |
| 3869 | // ); | 3844 | \\ |
| 3870 | //} | 3845 | \\ const zoom_node = if (focused_node == layout_first) while (it.next()) |node| { |
| | 3846 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| | 3847 | \\ } else null else focused_node; |
| | 3848 | \\ |
| | 3849 | \\ const zoom_node = if (focused_node == layout_first) |
| | 3850 | \\ if (it.next()) { |
| | 3851 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| | 3852 | \\ } else null; |
| | 3853 | \\ |
| | 3854 | \\ const zoom_node = if (focused_node == layout_first) while (it.next()) |node| { |
| | 3855 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| | 3856 | \\ }; |
| | 3857 | \\ |
| | 3858 | \\ const zoom_node = if (focused_node == layout_first) for (nodes) |node| { |
| | 3859 | \\ break node; |
| | 3860 | \\ }; |
| | 3861 | \\ |
| | 3862 | \\ const zoom_node = if (focused_node == layout_first) switch (nodes) { |
| | 3863 | \\ 0 => 0, |
| | 3864 | \\ } else focused_node; |
| | 3865 | \\} |
| | 3866 | \\ |
| | 3867 | ); |
| | 3868 | } |
| 3871 | | 3869 | |
| 3872 | test "zig fmt: regression test for #5722" { | 3870 | test "zig fmt: regression test for #5722" { |
| 3873 | try testCanonical( | 3871 | try testCanonical( |
| ... | @@ -4058,21 +4056,21 @@ test "zig fmt: trailing comma should force multiline 1 column" { | ... | @@ -4058,21 +4056,21 @@ test "zig fmt: trailing comma should force multiline 1 column" { |
| 4058 | ); | 4056 | ); |
| 4059 | } | 4057 | } |
| 4060 | | 4058 | |
| 4061 | //test "zig fmt: function params should align nicely" { | 4059 | test "zig fmt: function params should align nicely" { |
| 4062 | // try testCanonical( | 4060 | try testCanonical( |
| 4063 | // \\pub fn foo() void { | 4061 | \\pub fn foo() void { |
| 4064 | // \\ cases.addRuntimeSafety("slicing operator with sentinel", | 4062 | \\ cases.addRuntimeSafety("slicing operator with sentinel", |
| 4065 | // \\ \\const std = @import("std"); | 4063 | \\ \\const std = @import("std"); |
| 4066 | // \\ ++ check_panic_msg ++ | 4064 | \\ ++ check_panic_msg ++ |
| 4067 | // \\ \\pub fn main() void { | 4065 | \\ \\pub fn main() void { |
| 4068 | // \\ \\ var buf = [4]u8{'a','b','c',0}; | 4066 | \\ \\ var buf = [4]u8{'a','b','c',0}; |
| 4069 | // \\ \\ const slice = buf[0..:0]; | 4067 | \\ \\ const slice = buf[0..:0]; |
| 4070 | // \\ \\} | 4068 | \\ \\} |
| 4071 | // \\ ); | 4069 | \\ ); |
| 4072 | // \\} | 4070 | \\} |
| 4073 | // \\ | 4071 | \\ |
| 4074 | // ); | 4072 | ); |
| 4075 | //} | 4073 | } |
| 4076 | | 4074 | |
| 4077 | test "zig fmt: error for invalid bit range" { | 4075 | test "zig fmt: error for invalid bit range" { |
| 4078 | try testError( | 4076 | try testError( |