rust/src/test/run-pass/ivec-add.rs

15 lines
264 B
Rust
Raw Normal View History

fn double[T](a: &T) -> [T] { ret ~[a] + ~[a]; }
fn double_int(a: int) -> [int] { ret ~[a] + ~[a]; }
fn main() {
2011-07-27 07:19:39 -05:00
let d = double(1);
assert (d.(0) == 1);
assert (d.(1) == 1);
d = double_int(1);
assert (d.(0) == 1);
assert (d.(1) == 1);
}