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

/src/test/run-pass/tup.rs

http://github.com/jruderman/rust
Rust | 18 lines | 15 code | 2 blank | 1 comment | 4 complexity | 7a441401f994e9464ccd9a758ef1fe30 MD5 | raw file
 1// -*- rust -*-
 2type point = (int, int);
 3
 4fn f(p: point, x: int, y: int) {
 5    let (a, b) = p;
 6    assert (a == x);
 7    assert (b == y);
 8}
 9
10fn main() {
11    let p: point = (10, 20);
12    let (a, b) = p;
13    assert (a == 10);
14    assert (b == 20);
15    let p2: point = p;
16    f(p, 10, 20);
17    f(p2, 10, 20);
18}