| ... | ... | @@ -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" { |
| 3730 | | // try testCanonical( |
| 3731 | | // \\test "zig fmt:" { |
| 3732 | | // \\ try testTransform( |
| 3733 | | // \\ \\const X = struct { |
| 3734 | | // \\ \\ foo: i32, bar: i8 }; |
| 3735 | | // \\ , |
| 3736 | | // \\ \\const X = struct { |
| 3737 | | // \\ \\ foo: i32, bar: i8 |
| 3738 | | // \\ \\}; |
| 3739 | | // \\ \\ |
| 3740 | | // \\ ); |
| 3741 | | // \\} |
| 3742 | | // \\ |
| 3743 | | // ); |
| 3744 | | //} |
| 3729 | test "zig fmt: Only indent multiline string literals in function calls" { |
| 3730 | try testCanonical( |
| 3731 | \\test "zig fmt:" { |
| 3732 | \\ try testTransform( |
| 3733 | \\ \\const X = struct { |
| 3734 | \\ \\ foo: i32, bar: i8 }; |
| 3735 | \\ , |
| 3736 | \\ \\const X = struct { |
| 3737 | \\ \\ foo: i32, bar: i8 |
| 3738 | \\ \\}; |
| 3739 | \\ \\ |
| 3740 | \\ ); |
| 3741 | \\} |
| 3742 | \\ |
| 3743 | ); |
| 3744 | } |
| 3745 | 3745 | |
| 3746 | 3746 | test "zig fmt: Don't add extra newline after if" { |
| 3747 | 3747 | try testCanonical( |
| ... | ... | @@ -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" { |
| 3836 | | // try testCanonical( |
| 3837 | | // \\pub fn main() void { |
| 3838 | | // \\ const zoom_node = if (focused_node == layout_first) |
| 3839 | | // \\ if (it.next()) { |
| 3840 | | // \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| 3841 | | // \\ } else null |
| 3842 | | // \\ else |
| 3843 | | // \\ focused_node; |
| 3844 | | // \\ |
| 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 |
| 3848 | | // \\ focused_node; |
| 3849 | | // \\ |
| 3850 | | // \\ const zoom_node = if (focused_node == layout_first) |
| 3851 | | // \\ if (it.next()) { |
| 3852 | | // \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| 3853 | | // \\ } else null; |
| 3854 | | // \\ |
| 3855 | | // \\ const zoom_node = if (focused_node == layout_first) while (it.next()) |node| { |
| 3856 | | // \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| 3857 | | // \\ }; |
| 3858 | | // \\ |
| 3859 | | // \\ const zoom_node = if (focused_node == layout_first) for (nodes) |node| { |
| 3860 | | // \\ break node; |
| 3861 | | // \\ }; |
| 3862 | | // \\ |
| 3863 | | // \\ const zoom_node = if (focused_node == layout_first) switch (nodes) { |
| 3864 | | // \\ 0 => 0, |
| 3865 | | // \\ } else |
| 3866 | | // \\ focused_node; |
| 3867 | | // \\} |
| 3868 | | // \\ |
| 3869 | | // ); |
| 3870 | | //} |
| 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 | |
| 3835 | test "zig fmt: Control flow statement as body of blockless if" { |
| 3836 | try testCanonical( |
| 3837 | \\pub fn main() void { |
| 3838 | \\ const zoom_node = if (focused_node == layout_first) |
| 3839 | \\ if (it.next()) { |
| 3840 | \\ if (!node.view.pending.float and !node.view.pending.fullscreen) break node; |
| 3841 | \\ } else null |
| 3842 | \\ else |
| 3843 | \\ focused_node; |
| 3844 | \\ |
| 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 | 3870 | test "zig fmt: regression test for #5722" { |
| 3873 | 3871 | try testCanonical( |
| ... | ... | @@ -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" { |
| 4062 | | // try testCanonical( |
| 4063 | | // \\pub fn foo() void { |
| 4064 | | // \\ cases.addRuntimeSafety("slicing operator with sentinel", |
| 4065 | | // \\ \\const std = @import("std"); |
| 4066 | | // \\ ++ check_panic_msg ++ |
| 4067 | | // \\ \\pub fn main() void { |
| 4068 | | // \\ \\ var buf = [4]u8{'a','b','c',0}; |
| 4069 | | // \\ \\ const slice = buf[0..:0]; |
| 4070 | | // \\ \\} |
| 4071 | | // \\ ); |
| 4072 | | // \\} |
| 4073 | | // \\ |
| 4074 | | // ); |
| 4075 | | //} |
| 4059 | test "zig fmt: function params should align nicely" { |
| 4060 | try testCanonical( |
| 4061 | \\pub fn foo() void { |
| 4062 | \\ cases.addRuntimeSafety("slicing operator with sentinel", |
| 4063 | \\ \\const std = @import("std"); |
| 4064 | \\ ++ check_panic_msg ++ |
| 4065 | \\ \\pub fn main() void { |
| 4066 | \\ \\ var buf = [4]u8{'a','b','c',0}; |
| 4067 | \\ \\ const slice = buf[0..:0]; |
| 4068 | \\ \\} |
| 4069 | \\ ); |
| 4070 | \\} |
| 4071 | \\ |
| 4072 | ); |
| 4073 | } |
| 4076 | 4074 | |
| 4077 | 4075 | test "zig fmt: error for invalid bit range" { |
| 4078 | 4076 | try testError( |