summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/c/Issue_2360.c
blob: dd4530c7e062f1c518e4edd0ddefab922c01cd64 (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
int short_function();
int some_very_very_very_very_very_very_very_very_long_function();
int main() {
    // short condition, no existing newlines
    if (short_function()) {}

    // short condition, existing newlines
    if (
        short_function()
        ) {}

    // long condition, no newlines
    if (some_very_very_very_very_very_very_very_very_long_function() &&
        some_very_very_very_very_very_very_very_very_long_function()) {}

    // long condition, newlines
    else if (
            some_very_very_very_very_very_very_very_very_long_function() &&
            some_very_very_very_very_very_very_very_very_long_function()
            ) {}

    // switch condition
    switch (some_very_very_very_very_very_very_very_very_long_function() &&
        some_very_very_very_very_very_very_very_very_long_function()) {
    case default: break;
    }

    // while condition, line comments
    while (
        // comment 1
        short_function()
        // comment 2
        ) {}

    // for condition, inline comments
    for ( /* a */ int i=0; some_very_very_very_very_very_very_very_very_long_function()
    && some_very_very_very_very_very_very_very_very_long_function() && i < 10; i++ // trailing comment
    ){}
}