summary refs log tree commit diff
path: root/src/test/run-pass/weird-exprs.rs
blob: 27d45bde67d3ed28bb474d0fa50581ca7727dec0 (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
// Just a grab bag of stuff that you wouldn't want to actually write.

fn strange() -> bool { let _x: bool = ret true; }

fn funny() {
    fn f(_x: ()) { }
    f(ret);
}

fn what() {
    fn the(x: @mut bool) { ret while !*x { *x = true; }; }
    let i = @mut false;
    let dont = {||the(i)};
    dont();
    assert (*i);
}

fn zombiejesus() {
    loop {
        while (ret) {
            if (ret) {
                alt (ret) {
                    1 {
                        if (ret) {
                            ret
                        } else {
                            ret
                        }
                    }
                    _ { ret }
                };
            } else if (ret) {
                ret;
            }
        }
        if (ret) { break; }
    }
}

fn notsure() {
    let mut _x;
    let mut _y = (_x = 0) == (_x = 0);
    let mut _z = (_x <- 0) < (_x = 0);
    let _a = (_x += 0) == (_x = 0);
    let _b = (_y <-> _z) == (_y <-> _z);
}

fn hammertime() -> int {
    let _x = log(debug, true == (ret 0));
}

fn canttouchthis() -> uint {
    pure fn p() -> bool { true }
    let _a = (assert (true)) == (check (p()));
    let _c = (check (p())) == ();
    let _b: bool = (log(debug, 0) == (ret 0u));
}

fn angrydome() {
    loop { if break { } }
    let mut i = 0;
    loop { i += 1; if i == 1 { alt check again { 1 { } } } break; }
}

fn evil_lincoln() { let evil <- #debug("lincoln"); }

fn main() {
    strange();
    funny();
    what();
    zombiejesus();
    notsure();
    hammertime();
    canttouchthis();
    angrydome();
    evil_lincoln();
}