about summary refs log tree commit diff
path: root/src/test/run-pass/bind-obj-ctor.rs
blob: a76b17cc10a0b2bbd492c660b98aaa245f6c110e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn main() {
    // Testcase for issue #59.

    obj simple(x: int, y: int) {
        fn sum() -> int { ret x + y; }
    }
    let obj0 = simple(1, 2);
    let ctor0 = bind simple(1, _);
    let ctor1 = bind simple(_, 2);
    let obj1 = ctor0(2);
    let obj2 = ctor1(1);
    assert (obj0.sum() == 3);
    assert (obj1.sum() == 3);
    assert (obj2.sum() == 3);
}