rust/src/test/run-pass/bind-obj-ctor.rs

17 lines
367 B
Rust
Raw Normal View History

2010-06-23 23:03:09 -05:00
fn main() {
// Testcase for issue #59.
2010-06-23 23:03:09 -05:00
obj simple(int x, int y) {
fn sum() -> int { ret x + y; }
}
auto obj0 = simple(1, 2);
auto ctor0 = bind simple(1, _);
auto ctor1 = bind simple(_, 2);
auto obj1 = ctor0(2);
auto obj2 = ctor1(1);
assert (obj0.sum() == 3);
assert (obj1.sum() == 3);
assert (obj2.sum() == 3);
}