2012-04-11 21:45:18 -07:00
|
|
|
fn main() {
|
|
|
|
let mut c = 0u;
|
2012-10-10 00:28:04 -04:00
|
|
|
for [1u, 2u, 3u, 4u, 5u].eachi |i, v| {
|
2012-09-21 18:43:30 -07:00
|
|
|
assert (i + 1u) == *v;
|
2012-04-11 21:45:18 -07:00
|
|
|
c += 1u;
|
|
|
|
}
|
|
|
|
assert c == 5u;
|
|
|
|
|
2012-08-20 12:23:37 -07:00
|
|
|
for None::<uint>.eachi |i, v| { fail; }
|
2012-04-11 21:45:18 -07:00
|
|
|
|
|
|
|
let mut c = 0u;
|
2012-08-20 12:23:37 -07:00
|
|
|
for Some(1u).eachi |i, v| {
|
2012-09-21 18:43:30 -07:00
|
|
|
assert (i + 1u) == *v;
|
2012-04-11 21:45:18 -07:00
|
|
|
c += 1u;
|
|
|
|
}
|
|
|
|
assert c == 1u;
|
|
|
|
|
2012-06-29 16:26:56 -07:00
|
|
|
}
|