rust/src/test/run-fail/vec-underrun.rs

15 lines
237 B
Rust
Raw Normal View History

// xfail-stage0
// xfail-stage1
// xfail-stage2
2010-06-23 21:03:09 -07:00
// -*- rust -*-
// error-pattern::bounds check
2010-06-23 21:03:09 -07:00
fn main() {
let vec[int] v = vec(10, 20);
let int x = 0;
assert (v.(x) == 10);
2010-06-23 21:03:09 -07:00
// Bounds-check failure.
assert (v.(x-1) == 20);
2010-06-23 21:03:09 -07:00
}