2012-09-21 20:43:30 -05:00
|
|
|
fn inc(x: &uint) -> uint { *x + 1u }
|
2012-04-11 23:45:18 -05:00
|
|
|
|
|
|
|
fn main() {
|
2012-06-29 18:26:56 -05:00
|
|
|
assert [1u, 3u]/_.map_to_vec(inc) == ~[2u, 4u];
|
|
|
|
assert [1u, 2u, 3u]/_.map_to_vec(inc) == ~[2u, 3u, 4u];
|
2012-08-20 14:23:37 -05:00
|
|
|
assert None.map_to_vec(inc) == ~[];
|
|
|
|
assert Some(1u).map_to_vec(inc) == ~[2u];
|
|
|
|
assert Some(2u).map_to_vec(inc) == ~[3u];
|
2012-06-29 18:26:56 -05:00
|
|
|
}
|