rust/src/test/run-pass/bind-obj-ctor.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

18 lines
365 B
Rust

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);
}