rust/src/test/run-fail/unwind-misc-1.rs

25 lines
540 B
Rust
Raw Normal View History

// error-pattern:fail
use std;
2012-09-05 14:32:05 -05:00
use std::map;
use std::map::hashmap;
fn main() {
2012-03-26 20:35:18 -05:00
let count = @mut 0u;
pure fn hash(s: &~[@~str]) -> uint {
if vec::len(*s) > 0u && *s[0] == ~"boom" { fail; }
2012-08-01 19:30:05 -05:00
return 10u;
}
pure fn eq(s: &~[@~str], t: &~[@~str]) -> bool {
return *s == *t;
}
let map = map::hashmap(hash, eq);
let mut arr = ~[];
2012-06-30 18:19:07 -05:00
for uint::range(0u, 10u) |i| {
arr += ~[@~"key stuff"];
map.insert(arr, arr + ~[@~"value stuff"]);
}
map.insert(~[@~"boom"], ~[]);
}