rust/src/test/run-pass/rec-extend.rs

17 lines
372 B
Rust
Raw Normal View History

2010-06-23 23:03:09 -05:00
// -*- rust -*-
type point = rec(int x, int y);
2010-06-23 23:03:09 -05:00
fn main() {
let point origin = rec(x=0, y=0);
let point right = rec(x=origin.x + 10 with origin);
let point up = rec(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);
}