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

27 lines
456 B
Rust

// xfail-stage0
// Issue 483 - Assignment expressions result in nil
fn test_assign() {
let x: int;
let y: () = x = 10;
assert (x == 10);
let z = x = 11;
assert (x == 11);
z = x = 12;
assert (x == 12);
}
fn test_assign_op() {
let x: int = 0;
let y: () = x += 10;
assert (x == 10);
let z = x += 11;
assert (x == 21);
z = x += 12;
assert (x == 33);
}
fn main() { test_assign(); test_assign_op(); }