| ... | ... | @@ -1,12 +1,3 @@ |
| 1 | | test "zig fmt: aggregate type init with only 1 field" { |
| 2 | | try testCanonical( |
| 3 | | \\comptime { |
| 4 | | \\ assert(bar(Payload {.A = 1234}) == -10); |
| 5 | | \\} |
| 6 | | \\ |
| 7 | | ); |
| 8 | | } |
| 9 | | |
| 10 | 1 | test "zig fmt: union(enum(u32)) with assigned enum values" { |
| 11 | 2 | try testCanonical( |
| 12 | 3 | \\const MultipleChoice = union(enum(u32)) { |
| ... | ... | @@ -124,7 +115,7 @@ test "zig fmt: same-line comment after field decl" { |
| 124 | 115 | |
| 125 | 116 | test "zig fmt: array literal with 1 item on 1 line" { |
| 126 | 117 | try testCanonical( |
| 127 | | \\var s = []const u64 {0} ** 25; |
| 118 | \\var s = []const u64{0} ** 25; |
| 128 | 119 | \\ |
| 129 | 120 | ); |
| 130 | 121 | } |
| ... | ... | @@ -625,11 +616,11 @@ test "zig fmt: error set declaration" { |
| 625 | 616 | test "zig fmt: arrays" { |
| 626 | 617 | try testCanonical( |
| 627 | 618 | \\test "test array" { |
| 628 | | \\ const a: [2]u8 = [2]u8 { |
| 619 | \\ const a: [2]u8 = [2]u8{ |
| 629 | 620 | \\ 1, |
| 630 | 621 | \\ 2, |
| 631 | 622 | \\ }; |
| 632 | | \\ const a: [2]u8 = []u8 { |
| 623 | \\ const a: [2]u8 = []u8{ |
| 633 | 624 | \\ 1, |
| 634 | 625 | \\ 2, |
| 635 | 626 | \\ }; |
| ... | ... | @@ -641,15 +632,17 @@ test "zig fmt: arrays" { |
| 641 | 632 | |
| 642 | 633 | test "zig fmt: container initializers" { |
| 643 | 634 | try testCanonical( |
| 644 | | \\const a1 = []u8{}; |
| 645 | | \\const a2 = []u8 { |
| 635 | \\const a0 = []u8{}; |
| 636 | \\const a1 = []u8{1}; |
| 637 | \\const a2 = []u8{ |
| 646 | 638 | \\ 1, |
| 647 | 639 | \\ 2, |
| 648 | 640 | \\ 3, |
| 649 | 641 | \\ 4, |
| 650 | 642 | \\}; |
| 651 | | \\const s1 = S{}; |
| 652 | | \\const s2 = S { |
| 643 | \\const s0 = S{}; |
| 644 | \\const s1 = S{ .a = 1 }; |
| 645 | \\const s2 = S{ |
| 653 | 646 | \\ .a = 1, |
| 654 | 647 | \\ .b = 2, |
| 655 | 648 | \\}; |
| ... | ... | @@ -718,7 +711,6 @@ test "zig fmt: switch" { |
| 718 | 711 | \\ Float: f64, |
| 719 | 712 | \\ }; |
| 720 | 713 | \\ |
| 721 | | \\ const u = Union {.Int = 0}; |
| 722 | 714 | \\ switch (u) { |
| 723 | 715 | \\ Union.Int => |int| {}, |
| 724 | 716 | \\ Union.Float => |*float| unreachable, |
| ... | ... | @@ -797,11 +789,6 @@ test "zig fmt: while" { |
| 797 | 789 | test "zig fmt: for" { |
| 798 | 790 | try testCanonical( |
| 799 | 791 | \\test "for" { |
| 800 | | \\ const a = []u8 { |
| 801 | | \\ 1, |
| 802 | | \\ 2, |
| 803 | | \\ 3, |
| 804 | | \\ }; |
| 805 | 792 | \\ for (a) |v| { |
| 806 | 793 | \\ continue; |
| 807 | 794 | \\ } |
| ... | ... | @@ -1032,16 +1019,6 @@ test "zig fmt: error return" { |
| 1032 | 1019 | ); |
| 1033 | 1020 | } |
| 1034 | 1021 | |
| 1035 | | test "zig fmt: struct literals with fields on each line" { |
| 1036 | | try testCanonical( |
| 1037 | | \\var self = BufSet { |
| 1038 | | \\ .hash_map = BufSetHashMap.init(a), |
| 1039 | | \\ .hash_map2 = xyz, |
| 1040 | | \\}; |
| 1041 | | \\ |
| 1042 | | ); |
| 1043 | | } |
| 1044 | | |
| 1045 | 1022 | const std = @import("std"); |
| 1046 | 1023 | const mem = std.mem; |
| 1047 | 1024 | const warn = std.debug.warn; |