summaryrefslogtreecommitdiff
path: root/test cases/format/1 default/indentation.meson
blob: 14e1beb4049b1fd34e60a2a8523f6bfc78e35174 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
project(
    'indentation',
    default_options: {
        'buildtype': 'release',
        'default_library': 'shared',
        'prefer_static': false,
        'unity': 'off',
    },
    meson_version: '>= 1.5.0',
    version: '1.2.3',
)

a = [
    # comment
    # comment
    1,
    # comment
    2,
    3,
    [
        4,
        5,
        6,
        [
            7,
            8,
            9,
            [
                10,  # 10
                11,  # 11
                12,  # 12
            ],
            13,
            14,
            15,
        ],
    ],
]
d = {}

if meson.project_version().version_compare('>1.2')
    # comment
    # comment
    if meson.version().version_compare('>1.0')
        # comment
        # comment
        foreach i : a
            # comment
            e = {
                'a': 'a',
                'b': 'b',
                'c': 'c',
                'd': [
                    1,
                    2,
                    3,
                    {
                        'e': 'e',
                        'f': 'f',
                        'g': 'g',
                        'h': {
                            'i': (
                                # a
                                1
                                # b
                                +
                                # c
                                2
                            ),
                            'j': [
                                1,  # 1
                                2,  # 2
                                3,  # 3
                            ],
                        },
                    },
                ],
            }
        endforeach

        foreach j : a
            # comment
            # comment
            # comment
        endforeach
    elif 42 in d
        d += {'foo': 43}
    else  # ensure else is correctly indented (issue #13316)
        # comment
        k = 'k'
        # comment
        # comment
    endif
endif

# Test for trailing comma:
m = [1, 2, 3]
n = [
    1,
    2,
    3,
]

# Overindent regressions (issue #14935)
if (host_cpu_family == 'x86' and host_system in [
    'cygwin',
    'windows',
    'os2',
    'interix',
])
    message('hi')
endif

# Underindent in files() (issue #14998)
sources = files(
    # bar
    # more bar
    'bar.c',
    # foo
    # more foo
    'foo.c',
)