rust/src/test/run-pass/issue-718.rs

23 lines
336 B
Rust
Raw Normal View History

2011-07-20 15:19:22 -07:00
fn main() {
obj a() {
2011-07-27 14:19:39 +02:00
fn foo() -> int { ret 2; }
2011-07-20 15:19:22 -07:00
}
2011-07-27 14:19:39 +02:00
let my_a = a();
2011-07-20 15:19:22 -07:00
2011-07-27 14:19:39 +02:00
let my_b = obj () { with my_a };
2011-07-20 15:19:22 -07:00
assert (my_b.foo() == 2);
2011-07-27 14:19:39 +02:00
let my_c = obj () { with my_b };
2011-07-20 15:19:22 -07:00
assert (my_c.foo() == 2);
// ...One more for good measure.
let my_d = obj () { with my_b };
assert (my_d.foo() == 2);
2011-07-20 15:19:22 -07:00
}