| ... | @@ -1456,17 +1456,17 @@ test "zig fmt: if condition has line break but must not wrap (no fn call comma)" | ... | @@ -1456,17 +1456,17 @@ test "zig fmt: if condition has line break but must not wrap (no fn call comma)" |
| 1456 | ); | 1456 | ); |
| 1457 | } | 1457 | } |
| 1458 | | 1458 | |
| 1459 | //test "zig fmt: function call with multiline argument" { | 1459 | test "zig fmt: function call with multiline argument" { |
| 1460 | // try testCanonical( | 1460 | try testCanonical( |
| 1461 | // \\comptime { | 1461 | \\comptime { |
| 1462 | // \\ self.user_input_options.put(name, UserInputOption{ | 1462 | \\ self.user_input_options.put(name, UserInputOption{ |
| 1463 | // \\ .name = name, | 1463 | \\ .name = name, |
| 1464 | // \\ .used = false, | 1464 | \\ .used = false, |
| 1465 | // \\ }); | 1465 | \\ }); |
| 1466 | // \\} | 1466 | \\} |
| 1467 | // \\ | 1467 | \\ |
| 1468 | // ); | 1468 | ); |
| 1469 | //} | 1469 | } |
| 1470 | | 1470 | |
| 1471 | test "zig fmt: if-else with comment before else" { | 1471 | test "zig fmt: if-else with comment before else" { |
| 1472 | try testCanonical( | 1472 | try testCanonical( |
| ... | @@ -1817,14 +1817,24 @@ test "zig fmt: empty block with only comment" { | ... | @@ -1817,14 +1817,24 @@ test "zig fmt: empty block with only comment" { |
| 1817 | ); | 1817 | ); |
| 1818 | } | 1818 | } |
| 1819 | | 1819 | |
| 1820 | //test "zig fmt: no trailing comma on struct decl" { | 1820 | test "zig fmt: trailing commas on struct decl" { |
| 1821 | // try testCanonical( | 1821 | try testTransform( |
| 1822 | // \\const RoundParam = struct { | 1822 | \\const RoundParam = struct { |
| 1823 | // \\ k: usize, s: u32, t: u32 | 1823 | \\ k: usize, s: u32, t: u32 |
| 1824 | // \\}; | 1824 | \\}; |
| 1825 | // \\ | 1825 | \\const RoundParam = struct { |
| 1826 | // ); | 1826 | \\ k: usize, s: u32, t: u32, |
| 1827 | //} | 1827 | \\}; |
| | 1828 | , |
| | 1829 | \\const RoundParam = struct { k: usize, s: u32, t: u32 }; |
| | 1830 | \\const RoundParam = struct { |
| | 1831 | \\ k: usize, |
| | 1832 | \\ s: u32, |
| | 1833 | \\ t: u32, |
| | 1834 | \\}; |
| | 1835 | \\ |
| | 1836 | ); |
| | 1837 | } |
| 1828 | | 1838 | |
| 1829 | test "zig fmt: extra newlines at the end" { | 1839 | test "zig fmt: extra newlines at the end" { |
| 1830 | try testTransform( | 1840 | try testTransform( |
| ... | @@ -2975,75 +2985,75 @@ test "zig fmt: switch" { | ... | @@ -2975,75 +2985,75 @@ test "zig fmt: switch" { |
| 2975 | ); | 2985 | ); |
| 2976 | } | 2986 | } |
| 2977 | | 2987 | |
| 2978 | //test "zig fmt: while" { | 2988 | test "zig fmt: while" { |
| 2979 | // try testCanonical( | 2989 | try testCanonical( |
| 2980 | // \\test "while" { | 2990 | \\test "while" { |
| 2981 | // \\ while (10 < 1) unreachable; | 2991 | \\ while (10 < 1) unreachable; |
| 2982 | // \\ | 2992 | \\ |
| 2983 | // \\ while (10 < 1) unreachable else unreachable; | 2993 | \\ while (10 < 1) unreachable else unreachable; |
| 2984 | // \\ | 2994 | \\ |
| 2985 | // \\ while (10 < 1) { | 2995 | \\ while (10 < 1) { |
| 2986 | // \\ unreachable; | 2996 | \\ unreachable; |
| 2987 | // \\ } | 2997 | \\ } |
| 2988 | // \\ | 2998 | \\ |
| 2989 | // \\ while (10 < 1) | 2999 | \\ while (10 < 1) |
| 2990 | // \\ unreachable; | 3000 | \\ unreachable; |
| 2991 | // \\ | 3001 | \\ |
| 2992 | // \\ var i: usize = 0; | 3002 | \\ var i: usize = 0; |
| 2993 | // \\ while (i < 10) : (i += 1) { | 3003 | \\ while (i < 10) : (i += 1) { |
| 2994 | // \\ continue; | 3004 | \\ continue; |
| 2995 | // \\ } | 3005 | \\ } |
| 2996 | // \\ | 3006 | \\ |
| 2997 | // \\ i = 0; | 3007 | \\ i = 0; |
| 2998 | // \\ while (i < 10) : (i += 1) | 3008 | \\ while (i < 10) : (i += 1) |
| 2999 | // \\ continue; | 3009 | \\ continue; |
| 3000 | // \\ | 3010 | \\ |
| 3001 | // \\ i = 0; | 3011 | \\ i = 0; |
| 3002 | // \\ var j: usize = 0; | 3012 | \\ var j: usize = 0; |
| 3003 | // \\ while (i < 10) : ({ | 3013 | \\ while (i < 10) : ({ |
| 3004 | // \\ i += 1; | 3014 | \\ i += 1; |
| 3005 | // \\ j += 1; | 3015 | \\ j += 1; |
| 3006 | // \\ }) { | 3016 | \\ }) { |
| 3007 | // \\ continue; | 3017 | \\ continue; |
| 3008 | // \\ } | 3018 | \\ } |
| 3009 | // \\ | 3019 | \\ |
| 3010 | // \\ var a: ?u8 = 2; | 3020 | \\ var a: ?u8 = 2; |
| 3011 | // \\ while (a) |v| : (a = null) { | 3021 | \\ while (a) |v| : (a = null) { |
| 3012 | // \\ continue; | 3022 | \\ continue; |
| 3013 | // \\ } | 3023 | \\ } |
| 3014 | // \\ | 3024 | \\ |
| 3015 | // \\ while (a) |v| : (a = null) | 3025 | \\ while (a) |v| : (a = null) |
| 3016 | // \\ unreachable; | 3026 | \\ unreachable; |
| 3017 | // \\ | 3027 | \\ |
| 3018 | // \\ label: while (10 < 0) { | 3028 | \\ label: while (10 < 0) { |
| 3019 | // \\ unreachable; | 3029 | \\ unreachable; |
| 3020 | // \\ } | 3030 | \\ } |
| 3021 | // \\ | 3031 | \\ |
| 3022 | // \\ const res = while (0 < 10) { | 3032 | \\ const res = while (0 < 10) { |
| 3023 | // \\ break 7; | 3033 | \\ break 7; |
| 3024 | // \\ } else { | 3034 | \\ } else { |
| 3025 | // \\ unreachable; | 3035 | \\ unreachable; |
| 3026 | // \\ }; | 3036 | \\ }; |
| 3027 | // \\ | 3037 | \\ |
| 3028 | // \\ const res = while (0 < 10) | 3038 | \\ const res = while (0 < 10) |
| 3029 | // \\ break 7 | 3039 | \\ break 7 |
| 3030 | // \\ else | 3040 | \\ else |
| 3031 | // \\ unreachable; | 3041 | \\ unreachable; |
| 3032 | // \\ | 3042 | \\ |
| 3033 | // \\ var a: anyerror!u8 = 0; | 3043 | \\ var a: anyerror!u8 = 0; |
| 3034 | // \\ while (a) |v| { | 3044 | \\ while (a) |v| { |
| 3035 | // \\ a = error.Err; | 3045 | \\ a = error.Err; |
| 3036 | // \\ } else |err| { | 3046 | \\ } else |err| { |
| 3037 | // \\ i = 1; | 3047 | \\ i = 1; |
| 3038 | // \\ } | 3048 | \\ } |
| 3039 | // \\ | 3049 | \\ |
| 3040 | // \\ comptime var k: usize = 0; | 3050 | \\ comptime var k: usize = 0; |
| 3041 | // \\ inline while (i < 10) : (i += 1) | 3051 | \\ inline while (i < 10) : (i += 1) |
| 3042 | // \\ j += 2; | 3052 | \\ j += 2; |
| 3043 | // \\} | 3053 | \\} |
| 3044 | // \\ | 3054 | \\ |
| 3045 | // ); | 3055 | ); |
| 3046 | //} | 3056 | } |
| 3047 | | 3057 | |
| 3048 | test "zig fmt: for" { | 3058 | test "zig fmt: for" { |
| 3049 | try testCanonical( | 3059 | try testCanonical( |