summary refs log tree commit diff
path: root/tests/pretty/if-else.pp
blob: f29b693e571ebd0d5aea50bbcaf5c35e6b69118a (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
#![feature(prelude_import)]
#![no_std]
#[macro_use]
extern crate std;
#[prelude_import]
use ::std::prelude::rust_2015::*;
//@ pretty-compare-only
//@ pretty-mode:expanded
//@ pp-exact:if-else.pp

fn f(x: u32, y: u32) {
    let mut a = 0;
    if x > y { a = 1; } else { a = 2; }

    if x < 1 {
        a = 1;
    } else if x < 2 {
        a = 2;
    } else if x < 3 { a = 3; } else if x < 4 { a = 4; } else { a = 5; }

    if x < y {
        a += 1;
        a += 1;
        a += 1;
    } else {
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
        a += 1;
    }

    if x < 1 {
        if x < 2 {
            if x < 3 {
                a += 1;
            } else if x < 4 { a += 1; if x < 5 { a += 1; } }
        } else if x < 6 { a += 1; }
    }
}

fn main() { f(3, 4); }