| ... | ... | @@ -3790,40 +3790,88 @@ test "zig fmt: comments in ternary ifs" { |
| 3790 | 3790 | ); |
| 3791 | 3791 | } |
| 3792 | 3792 | |
| 3793 | | //test "zig fmt: test comments in field access chain" { |
| 3794 | | // try testCanonical( |
| 3795 | | // \\pub const str = struct { |
| 3796 | | // \\ pub const Thing = more.more // |
| 3797 | | // \\ .more() // |
| 3798 | | // \\ .more().more() // |
| 3799 | | // \\ .more() // |
| 3800 | | // \\ // .more() // |
| 3801 | | // \\ .more() // |
| 3802 | | // \\ .more(); |
| 3803 | | // \\ data: Data, |
| 3804 | | // \\}; |
| 3805 | | // \\ |
| 3806 | | // \\pub const str = struct { |
| 3807 | | // \\ pub const Thing = more.more // |
| 3808 | | // \\ .more() // |
| 3809 | | // \\ // .more() // |
| 3810 | | // \\ // .more() // |
| 3811 | | // \\ // .more() // |
| 3812 | | // \\ .more() // |
| 3813 | | // \\ .more(); |
| 3814 | | // \\ data: Data, |
| 3815 | | // \\}; |
| 3816 | | // \\ |
| 3817 | | // \\pub const str = struct { |
| 3818 | | // \\ pub const Thing = more // |
| 3819 | | // \\ .more // |
| 3820 | | // \\ .more() // |
| 3821 | | // \\ .more(); |
| 3822 | | // \\ data: Data, |
| 3823 | | // \\}; |
| 3824 | | // \\ |
| 3825 | | // ); |
| 3826 | | //} |
| 3793 | test "zig fmt: test comments in field access chain" { |
| 3794 | try testCanonical( |
| 3795 | \\pub const str = struct { |
| 3796 | \\ pub const Thing = more.more // |
| 3797 | \\ .more() // |
| 3798 | \\ .more().more() // |
| 3799 | \\ .more() // |
| 3800 | \\ // .more() // |
| 3801 | \\ .more() // |
| 3802 | \\ .more(); |
| 3803 | \\ data: Data, |
| 3804 | \\}; |
| 3805 | \\ |
| 3806 | \\pub const str = struct { |
| 3807 | \\ pub const Thing = more.more // |
| 3808 | \\ .more() // |
| 3809 | \\ // .more() // |
| 3810 | \\ // .more() // |
| 3811 | \\ // .more() // |
| 3812 | \\ .more() // |
| 3813 | \\ .more(); |
| 3814 | \\ data: Data, |
| 3815 | \\}; |
| 3816 | \\ |
| 3817 | \\pub const str = struct { |
| 3818 | \\ pub const Thing = more // |
| 3819 | \\ .more // |
| 3820 | \\ .more() // |
| 3821 | \\ .more(); |
| 3822 | \\ data: Data, |
| 3823 | \\}; |
| 3824 | \\ |
| 3825 | ); |
| 3826 | } |
| 3827 | |
| 3828 | test "zig fmt: allow line break before field access" { |
| 3829 | try testCanonical( |
| 3830 | \\test { |
| 3831 | \\ const w = foo.bar().zippy(zag).iguessthisisok(); |
| 3832 | \\ |
| 3833 | \\ const x = foo |
| 3834 | \\ .bar() |
| 3835 | \\ . // comment |
| 3836 | \\ // comment |
| 3837 | \\ swooop().zippy(zag) |
| 3838 | \\ .iguessthisisok(); |
| 3839 | \\ |
| 3840 | \\ const y = view.output.root.server.input_manager.default_seat.wlr_seat.name; |
| 3841 | \\ |
| 3842 | \\ const z = view.output.root.server |
| 3843 | \\ .input_manager // |
| 3844 | \\ .default_seat |
| 3845 | \\ . // comment |
| 3846 | \\ // another comment |
| 3847 | \\ wlr_seat.name; |
| 3848 | \\} |
| 3849 | \\ |
| 3850 | ); |
| 3851 | try testTransform( |
| 3852 | \\test { |
| 3853 | \\ const x = foo. |
| 3854 | \\ bar() |
| 3855 | \\ .zippy(zag).iguessthisisok(); |
| 3856 | \\ |
| 3857 | \\ const z = view.output.root.server. |
| 3858 | \\ input_manager. |
| 3859 | \\ default_seat.wlr_seat.name; |
| 3860 | \\} |
| 3861 | \\ |
| 3862 | , |
| 3863 | \\test { |
| 3864 | \\ const x = foo |
| 3865 | \\ .bar() |
| 3866 | \\ .zippy(zag).iguessthisisok(); |
| 3867 | \\ |
| 3868 | \\ const z = view.output.root.server |
| 3869 | \\ .input_manager |
| 3870 | \\ .default_seat.wlr_seat.name; |
| 3871 | \\} |
| 3872 | \\ |
| 3873 | ); |
| 3874 | } |
| 3827 | 3875 | |
| 3828 | 3876 | test "zig fmt: Indent comma correctly after multiline string literals in arg list (trailing comma)" { |
| 3829 | 3877 | try testCanonical( |