PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/jruderman/rust
Rust | 17 lines | 12 code | 4 blank | 1 comment | 6 complexity | c685e7631745230b294447ca2769486d MD5 | raw file
 1
 2
 3
 4// -*- rust -*-
 5type point = {x: int, y: int};
 6
 7fn main() {
 8    let origin: point = {x: 0, y: 0};
 9    let right: point = {x: origin.x + 10 with origin};
10    let up: point = {y: origin.y + 10 with origin};
11    assert (origin.x == 0);
12    assert (origin.y == 0);
13    assert (right.x == 10);
14    assert (right.y == 0);
15    assert (up.x == 0);
16    assert (up.y == 10);
17}