rust/src/test/run-pass/rec-extend.rs
2011-07-27 15:54:33 +02:00

17 lines
369 B
Rust

// -*- rust -*-
type point = {x: int, y: int};
fn main() {
let origin: point = {x: 0, y: 0};
let right: point = {x: origin.x + 10 with origin};
let up: point = {y: origin.y + 10 with origin};
assert (origin.x == 0);
assert (origin.y == 0);
assert (right.x == 10);
assert (right.y == 0);
assert (up.x == 0);
assert (up.y == 10);
}