| ... | @@ -1655,112 +1655,110 @@ test "zig fmt: struct literal containing a multiline expression" { | ... | @@ -1655,112 +1655,110 @@ test "zig fmt: struct literal containing a multiline expression" { |
| 1655 | ); | 1655 | ); |
| 1656 | } | 1656 | } |
| 1657 | | 1657 | |
| 1658 | //test "zig fmt: array literal with hint" { | 1658 | test "zig fmt: array literal with hint" { |
| 1659 | // try testTransform( | 1659 | try testTransform( |
| 1660 | // \\const a = []u8{ | 1660 | \\const a = []u8{ |
| 1661 | // \\ 1, 2, // | 1661 | \\ 1, 2, // |
| 1662 | // \\ 3, | 1662 | \\ 3, |
| 1663 | // \\ 4, | 1663 | \\ 4, |
| 1664 | // \\ 5, | 1664 | \\ 5, |
| 1665 | // \\ 6, | 1665 | \\ 6, |
| 1666 | // \\ 7 }; | 1666 | \\ 7 }; |
| 1667 | // \\const a = []u8{ | 1667 | \\const a = []u8{ |
| 1668 | // \\ 1, 2, // | 1668 | \\ 1, 2, // |
| 1669 | // \\ 3, | 1669 | \\ 3, |
| 1670 | // \\ 4, | 1670 | \\ 4, |
| 1671 | // \\ 5, | 1671 | \\ 5, |
| 1672 | // \\ 6, | 1672 | \\ 6, |
| 1673 | // \\ 7, 8 }; | 1673 | \\ 7, 8 }; |
| 1674 | // \\const a = []u8{ | 1674 | \\const a = []u8{ |
| 1675 | // \\ 1, 2, // | 1675 | \\ 1, 2, // |
| 1676 | // \\ 3, | 1676 | \\ 3, |
| 1677 | // \\ 4, | 1677 | \\ 4, |
| 1678 | // \\ 5, | 1678 | \\ 5, |
| 1679 | // \\ 6, // blah | 1679 | \\ 6, // blah |
| 1680 | // \\ 7, 8 }; | 1680 | \\ 7, 8 }; |
| 1681 | // \\const a = []u8{ | 1681 | \\const a = []u8{ |
| 1682 | // \\ 1, 2, // | 1682 | \\ 1, 2, // |
| 1683 | // \\ 3, // | 1683 | \\ 3, // |
| 1684 | // \\ 4, | 1684 | \\ 4, |
| 1685 | // \\ 5, | 1685 | \\ 5, |
| 1686 | // \\ 6, | 1686 | \\ 6, |
| 1687 | // \\ 7 }; | 1687 | \\ 7 }; |
| 1688 | // \\const a = []u8{ | 1688 | \\const a = []u8{ |
| 1689 | // \\ 1, | 1689 | \\ 1, |
| 1690 | // \\ 2, | 1690 | \\ 2, |
| 1691 | // \\ 3, 4, // | 1691 | \\ 3, 4, // |
| 1692 | // \\ 5, 6, // | 1692 | \\ 5, 6, // |
| 1693 | // \\ 7, 8, // | 1693 | \\ 7, 8, // |
| 1694 | // \\}; | 1694 | \\}; |
| 1695 | // , | 1695 | , |
| 1696 | // \\const a = []u8{ | 1696 | \\const a = []u8{ |
| 1697 | // \\ 1, 2, | 1697 | \\ 1, 2, // |
| 1698 | // \\ 3, 4, | 1698 | \\ 3, 4, |
| 1699 | // \\ 5, 6, | 1699 | \\ 5, 6, |
| 1700 | // \\ 7, | 1700 | \\ 7, |
| 1701 | // \\}; | 1701 | \\}; |
| 1702 | // \\const a = []u8{ | 1702 | \\const a = []u8{ |
| 1703 | // \\ 1, 2, | 1703 | \\ 1, 2, // |
| 1704 | // \\ 3, 4, | 1704 | \\ 3, 4, |
| 1705 | // \\ 5, 6, | 1705 | \\ 5, 6, |
| 1706 | // \\ 7, 8, | 1706 | \\ 7, 8, |
| 1707 | // \\}; | 1707 | \\}; |
| 1708 | // \\const a = []u8{ | 1708 | \\const a = []u8{ |
| 1709 | // \\ 1, 2, | 1709 | \\ 1, 2, // |
| 1710 | // \\ 3, 4, | 1710 | \\ 3, 4, |
| 1711 | // \\ 5, | 1711 | \\ 5, |
| 1712 | // \\ 6, // blah | 1712 | \\ 6, // blah |
| 1713 | // \\ 7, | 1713 | \\ 7, |
| 1714 | // \\ 8, | 1714 | \\ 8, |
| 1715 | // \\}; | 1715 | \\}; |
| 1716 | // \\const a = []u8{ | 1716 | \\const a = []u8{ |
| 1717 | // \\ 1, 2, | 1717 | \\ 1, 2, // |
| 1718 | // \\ 3, // | 1718 | \\ 3, // |
| 1719 | // \\ 4, | 1719 | \\ 4, |
| 1720 | // \\ 5, 6, | 1720 | \\ 5, |
| 1721 | // \\ 7, | 1721 | \\ 6, |
| 1722 | // \\}; | 1722 | \\ 7, |
| 1723 | // \\const a = []u8{ | 1723 | \\}; |
| 1724 | // \\ 1, | 1724 | \\const a = []u8{ |
| 1725 | // \\ 2, | 1725 | \\ 1, |
| 1726 | // \\ 3, | 1726 | \\ 2, |
| 1727 | // \\ 4, | 1727 | \\ 3, 4, // |
| 1728 | // \\ 5, | 1728 | \\ 5, 6, // |
| 1729 | // \\ 6, | 1729 | \\ 7, 8, // |
| 1730 | // \\ 7, | 1730 | \\}; |
| 1731 | // \\ 8, | 1731 | \\ |
| 1732 | // \\}; | 1732 | ); |
| 1733 | // \\ | 1733 | } |
| 1734 | // ); | 1734 | |
| 1735 | //} | 1735 | test "zig fmt: array literal veritical column alignment" { |
| 1736 | // | 1736 | try testTransform( |
| 1737 | //test "zig fmt: array literal veritical column alignment" { | 1737 | \\const a = []u8{ |
| 1738 | // try testTransform( | 1738 | \\ 1000, 200, |
| 1739 | // \\const a = []u8{ | 1739 | \\ 30, 4, |
| 1740 | // \\ 1000, 200, | 1740 | \\ 50000, 60 |
| 1741 | // \\ 30, 4, | 1741 | \\}; |
| 1742 | // \\ 50000, 60 | 1742 | \\const a = []u8{0, 1, 2, 3, 40, |
| 1743 | // \\}; | 1743 | \\ 4,5,600,7, |
| 1744 | // \\const a = []u8{0, 1, 2, 3, 40, | 1744 | \\ 80, |
| 1745 | // \\ 4,5,600,7, | 1745 | \\ 9, 10, 11, 0, 13, 14, 15}; |
| 1746 | // \\ 80, | 1746 | \\ |
| 1747 | // \\ 9, 10, 11, 0, 13, 14, 15}; | 1747 | , |
| 1748 | // \\ | 1748 | \\const a = []u8{ |
| 1749 | // , | 1749 | \\ 1000, 200, |
| 1750 | // \\const a = []u8{ | 1750 | \\ 30, 4, |
| 1751 | // \\ 1000, 200, | 1751 | \\ 50000, 60, |
| 1752 | // \\ 30, 4, | 1752 | \\}; |
| 1753 | // \\ 50000, 60, | 1753 | \\const a = []u8{ |
| 1754 | // \\}; | 1754 | \\ 0, 1, 2, 3, 40, |
| 1755 | // \\const a = []u8{ | 1755 | \\ 4, 5, 600, 7, 80, |
| 1756 | // \\ 0, 1, 2, 3, 40, | 1756 | \\ 9, 10, 11, 0, 13, |
| 1757 | // \\ 4, 5, 600, 7, 80, | 1757 | \\ 14, 15, |
| 1758 | // \\ 9, 10, 11, 0, 13, | 1758 | \\}; |
| 1759 | // \\ 14, 15, | 1759 | \\ |
| 1760 | // \\}; | 1760 | ); |
| 1761 | // \\ | 1761 | } |
| 1762 | // ); | | |
| 1763 | //} | | |
| 1764 | | 1762 | |
| 1765 | test "zig fmt: multiline string with backslash at end of line" { | 1763 | test "zig fmt: multiline string with backslash at end of line" { |
| 1766 | try testCanonical( | 1764 | try testCanonical( |
| ... | @@ -1949,29 +1947,29 @@ test "zig fmt: slice align" { | ... | @@ -1949,29 +1947,29 @@ test "zig fmt: slice align" { |
| 1949 | ); | 1947 | ); |
| 1950 | } | 1948 | } |
| 1951 | | 1949 | |
| 1952 | //test "zig fmt: add trailing comma to array literal" { | 1950 | test "zig fmt: add trailing comma to array literal" { |
| 1953 | // try testTransform( | 1951 | try testTransform( |
| 1954 | // \\comptime { | 1952 | \\comptime { |
| 1955 | // \\ return []u16{'m', 's', 'y', 's', '-' // hi | 1953 | \\ return []u16{'m', 's', 'y', 's', '-' // hi |
| 1956 | // \\ }; | 1954 | \\ }; |
| 1957 | // \\ return []u16{'m', 's', 'y', 's', | 1955 | \\ return []u16{'m', 's', 'y', 's', |
| 1958 | // \\ '-'}; | 1956 | \\ '-'}; |
| 1959 | // \\ return []u16{'m', 's', 'y', 's', '-'}; | 1957 | \\ return []u16{'m', 's', 'y', 's', '-'}; |
| 1960 | // \\} | 1958 | \\} |
| 1961 | // , | 1959 | , |
| 1962 | // \\comptime { | 1960 | \\comptime { |
| 1963 | // \\ return []u16{ | 1961 | \\ return []u16{ |
| 1964 | // \\ 'm', 's', 'y', 's', '-', // hi | 1962 | \\ 'm', 's', 'y', 's', '-', // hi |
| 1965 | // \\ }; | 1963 | \\ }; |
| 1966 | // \\ return []u16{ | 1964 | \\ return []u16{ |
| 1967 | // \\ 'm', 's', 'y', 's', | 1965 | \\ 'm', 's', 'y', 's', |
| 1968 | // \\ '-', | 1966 | \\ '-', |
| 1969 | // \\ }; | 1967 | \\ }; |
| 1970 | // \\ return []u16{ 'm', 's', 'y', 's', '-' }; | 1968 | \\ return []u16{ 'm', 's', 'y', 's', '-' }; |
| 1971 | // \\} | 1969 | \\} |
| 1972 | // \\ | 1970 | \\ |
| 1973 | // ); | 1971 | ); |
| 1974 | //} | 1972 | } |
| 1975 | | 1973 | |
| 1976 | test "zig fmt: first thing in file is line comment" { | 1974 | test "zig fmt: first thing in file is line comment" { |
| 1977 | try testCanonical( | 1975 | try testCanonical( |
| ... | @@ -3406,30 +3404,30 @@ test "zig fmt: comptime block in container" { | ... | @@ -3406,30 +3404,30 @@ test "zig fmt: comptime block in container" { |
| 3406 | // ); | 3404 | // ); |
| 3407 | //} | 3405 | //} |
| 3408 | | 3406 | |
| 3409 | //test "zig fmt: multiline string in array" { | 3407 | test "zig fmt: multiline string in array" { |
| 3410 | // try testCanonical( | 3408 | try testCanonical( |
| 3411 | // \\const Foo = [][]const u8{ | 3409 | \\const Foo = [][]const u8{ |
| 3412 | // \\ \\aaa | 3410 | \\ \\aaa |
| 3413 | // \\ , | 3411 | \\ , |
| 3414 | // \\ \\bbb | 3412 | \\ \\bbb |
| 3415 | // \\}; | 3413 | \\}; |
| 3416 | // \\ | 3414 | \\ |
| 3417 | // \\fn bar() void { | 3415 | \\fn bar() void { |
| 3418 | // \\ const Foo = [][]const u8{ | 3416 | \\ const Foo = [][]const u8{ |
| 3419 | // \\ \\aaa | 3417 | \\ \\aaa |
| 3420 | // \\ , | 3418 | \\ , |
| 3421 | // \\ \\bbb | 3419 | \\ \\bbb |
| 3422 | // \\ }; | 3420 | \\ }; |
| 3423 | // \\ const Bar = [][]const u8{ // comment here | 3421 | \\ const Bar = [][]const u8{ // comment here |
| 3424 | // \\ \\aaa | 3422 | \\ \\aaa |
| 3425 | // \\ \\ | 3423 | \\ \\ |
| 3426 | // \\ , // and another comment can go here | 3424 | \\ , // and another comment can go here |
| 3427 | // \\ \\bbb | 3425 | \\ \\bbb |
| 3428 | // \\ }; | 3426 | \\ }; |
| 3429 | // \\} | 3427 | \\} |
| 3430 | // \\ | 3428 | \\ |
| 3431 | // ); | 3429 | ); |
| 3432 | //} | 3430 | } |
| 3433 | | 3431 | |
| 3434 | test "zig fmt: if type expr" { | 3432 | test "zig fmt: if type expr" { |
| 3435 | try testCanonical( | 3433 | try testCanonical( |
| ... | @@ -3449,19 +3447,21 @@ test "zig fmt: file ends with struct field" { | ... | @@ -3449,19 +3447,21 @@ test "zig fmt: file ends with struct field" { |
| 3449 | ); | 3447 | ); |
| 3450 | } | 3448 | } |
| 3451 | | 3449 | |
| 3452 | test "zig fmt: comment after empty comment" { | 3450 | // TODO intentionally change the behavior of this case? |
| 3453 | try testTransform( | 3451 | // for array literals we necessarily have meaningful empty comments |
| 3454 | \\const x = true; // | 3452 | //test "zig fmt: comment after empty comment" { |
| 3455 | \\// | 3453 | // try testTransform( |
| 3456 | \\// | 3454 | // \\const x = true; // |
| 3457 | \\//a | 3455 | // \\// |
| 3458 | \\ | 3456 | // \\// |
| 3459 | , | 3457 | // \\//a |
| 3460 | \\const x = true; | 3458 | // \\ |
| 3461 | \\//a | 3459 | // , |
| 3462 | \\ | 3460 | // \\const x = true; |
| 3463 | ); | 3461 | // \\//a |
| 3464 | } | 3462 | // \\ |
| | 3463 | // ); |
| | 3464 | //} |
| 3465 | | 3465 | |
| 3466 | //test "zig fmt: line comment in array" { | 3466 | //test "zig fmt: line comment in array" { |
| 3467 | // try testTransform( | 3467 | // try testTransform( |
| ... | @@ -3493,7 +3493,7 @@ test "zig fmt: comment after empty comment" { | ... | @@ -3493,7 +3493,7 @@ test "zig fmt: comment after empty comment" { |
| 3493 | // \\ | 3493 | // \\ |
| 3494 | // ); | 3494 | // ); |
| 3495 | //} | 3495 | //} |
| 3496 | // | 3496 | |
| 3497 | //test "zig fmt: comment after params" { | 3497 | //test "zig fmt: comment after params" { |
| 3498 | // try testTransform( | 3498 | // try testTransform( |
| 3499 | // \\fn a( | 3499 | // \\fn a( |
| ... | @@ -3518,7 +3518,7 @@ test "zig fmt: comment after empty comment" { | ... | @@ -3518,7 +3518,7 @@ test "zig fmt: comment after empty comment" { |
| 3518 | // \\ | 3518 | // \\ |
| 3519 | // ); | 3519 | // ); |
| 3520 | //} | 3520 | //} |
| 3521 | // | 3521 | |
| 3522 | //test "zig fmt: comment in array initializer/access" { | 3522 | //test "zig fmt: comment in array initializer/access" { |
| 3523 | // try testCanonical( | 3523 | // try testCanonical( |
| 3524 | // \\test "a" { | 3524 | // \\test "a" { |
| ... | @@ -3550,7 +3550,7 @@ test "zig fmt: comment after empty comment" { | ... | @@ -3550,7 +3550,7 @@ test "zig fmt: comment after empty comment" { |
| 3550 | // \\ | 3550 | // \\ |
| 3551 | // ); | 3551 | // ); |
| 3552 | //} | 3552 | //} |
| 3553 | // | 3553 | |
| 3554 | //test "zig fmt: comments at several places in struct init" { | 3554 | //test "zig fmt: comments at several places in struct init" { |
| 3555 | // try testTransform( | 3555 | // try testTransform( |
| 3556 | // \\var bar = Bar{ | 3556 | // \\var bar = Bar{ |
| ... | @@ -3899,44 +3899,44 @@ test "zig fmt: regression test for #5722" { | ... | @@ -3899,44 +3899,44 @@ test "zig fmt: regression test for #5722" { |
| 3899 | ); | 3899 | ); |
| 3900 | } | 3900 | } |
| 3901 | | 3901 | |
| 3902 | //test "zig fmt: allow trailing line comments to do manual array formatting" { | 3902 | test "zig fmt: allow trailing line comments to do manual array formatting" { |
| 3903 | // try testCanonical( | 3903 | try testCanonical( |
| 3904 | // \\fn foo() void { | 3904 | \\fn foo() void { |
| 3905 | // \\ self.code.appendSliceAssumeCapacity(&[_]u8{ | 3905 | \\ self.code.appendSliceAssumeCapacity(&[_]u8{ |
| 3906 | // \\ 0x55, // push rbp | 3906 | \\ 0x55, // push rbp |
| 3907 | // \\ 0x48, 0x89, 0xe5, // mov rbp, rsp | 3907 | \\ 0x48, 0x89, 0xe5, // mov rbp, rsp |
| 3908 | // \\ 0x48, 0x81, 0xec, // sub rsp, imm32 (with reloc) | 3908 | \\ 0x48, 0x81, 0xec, // sub rsp, imm32 (with reloc) |
| 3909 | // \\ }); | 3909 | \\ }); |
| 3910 | // \\ | 3910 | \\ |
| 3911 | // \\ di_buf.appendAssumeCapacity(&[_]u8{ | 3911 | \\ di_buf.appendAssumeCapacity(&[_]u8{ |
| 3912 | // \\ 1, DW.TAG_compile_unit, DW.CHILDREN_no, // header | 3912 | \\ 1, DW.TAG_compile_unit, DW.CHILDREN_no, // header |
| 3913 | // \\ DW.AT_stmt_list, DW_FORM_data4, // form value pairs | 3913 | \\ DW.AT_stmt_list, DW_FORM_data4, // form value pairs |
| 3914 | // \\ DW.AT_low_pc, DW_FORM_addr, | 3914 | \\ DW.AT_low_pc, DW_FORM_addr, |
| 3915 | // \\ DW.AT_high_pc, DW_FORM_addr, | 3915 | \\ DW.AT_high_pc, DW_FORM_addr, |
| 3916 | // \\ DW.AT_name, DW_FORM_strp, | 3916 | \\ DW.AT_name, DW_FORM_strp, |
| 3917 | // \\ DW.AT_comp_dir, DW_FORM_strp, | 3917 | \\ DW.AT_comp_dir, DW_FORM_strp, |
| 3918 | // \\ DW.AT_producer, DW_FORM_strp, | 3918 | \\ DW.AT_producer, DW_FORM_strp, |
| 3919 | // \\ DW.AT_language, DW_FORM_data2, | 3919 | \\ DW.AT_language, DW_FORM_data2, |
| 3920 | // \\ 0, 0, // sentinel | 3920 | \\ 0, 0, // sentinel |
| 3921 | // \\ }); | 3921 | \\ }); |
| 3922 | // \\ | 3922 | \\ |
| 3923 | // \\ self.code.appendSliceAssumeCapacity(&[_]u8{ | 3923 | \\ self.code.appendSliceAssumeCapacity(&[_]u8{ |
| 3924 | // \\ 0x55, // push rbp | 3924 | \\ 0x55, // push rbp |
| 3925 | // \\ 0x48, 0x89, 0xe5, // mov rbp, rsp | 3925 | \\ 0x48, 0x89, 0xe5, // mov rbp, rsp |
| 3926 | // \\ // How do we handle this? | 3926 | \\ // How do we handle this? |
| 3927 | // \\ //0x48, 0x81, 0xec, // sub rsp, imm32 (with reloc) | 3927 | \\ //0x48, 0x81, 0xec, // sub rsp, imm32 (with reloc) |
| 3928 | // \\ // Here's a blank line, should that be allowed? | 3928 | \\ // Here's a blank line, should that be allowed? |
| 3929 | // \\ | 3929 | \\ |
| 3930 | // \\ 0x48, 0x89, 0xe5, | 3930 | \\ 0x48, 0x89, 0xe5, |
| 3931 | // \\ 0x33, 0x45, | 3931 | \\ 0x33, 0x45, |
| 3932 | // \\ // Now the comment breaks a single line -- how do we handle this? | 3932 | \\ // Now the comment breaks a single line -- how do we handle this? |
| 3933 | // \\ 0x88, | 3933 | \\ 0x88, |
| 3934 | // \\ }); | 3934 | \\ }); |
| 3935 | // \\} | 3935 | \\} |
| 3936 | // \\ | 3936 | \\ |
| 3937 | // ); | 3937 | ); |
| 3938 | //} | 3938 | } |
| 3939 | // | 3939 | |
| 3940 | //test "zig fmt: multiline string literals should play nice with array initializers" { | 3940 | //test "zig fmt: multiline string literals should play nice with array initializers" { |
| 3941 | // try testCanonical( | 3941 | // try testCanonical( |
| 3942 | // \\fn main() void { | 3942 | // \\fn main() void { |
| ... | @@ -3999,7 +3999,7 @@ test "zig fmt: regression test for #5722" { | ... | @@ -3999,7 +3999,7 @@ test "zig fmt: regression test for #5722" { |
| 3999 | // \\ | 3999 | // \\ |
| 4000 | // ); | 4000 | // ); |
| 4001 | //} | 4001 | //} |
| 4002 | // | 4002 | |
| 4003 | //test "zig fmt: use of comments and Multiline string literals may force the parameters over multiple lines" { | 4003 | //test "zig fmt: use of comments and Multiline string literals may force the parameters over multiple lines" { |
| 4004 | // try testCanonical( | 4004 | // try testCanonical( |
| 4005 | // \\pub fn makeMemUndefined(qzz: []u8) i1 { | 4005 | // \\pub fn makeMemUndefined(qzz: []u8) i1 { |