| 295 | #[test] |
| 296 | #[should_panic = "wrong store"] |
| 297 | fn array_get_wrong_store() { |
| 298 | let mut store1 = gc_store().unwrap(); |
| 299 | let mut store2 = gc_store().unwrap(); |
| 300 | |
| 301 | let array_ty = ArrayType::new( |
| 302 | store1.engine(), |
| 303 | FieldType::new(Mutability::Const, ValType::I32.into()), |
| 304 | ); |
| 305 | let pre = ArrayRefPre::new(&mut store1, array_ty); |
| 306 | |
| 307 | let array = ArrayRef::new_fixed(&mut store1, &pre, &[Val::I32(11)]).unwrap(); |
| 308 | |
| 309 | // Should panic. |
| 310 | let _ = array.get(&mut store2, 0); |
| 311 | } |
| 312 | |
| 313 | #[test] |
| 314 | fn array_set_in_bounds() -> Result<()> { |