| 253 | |
| 254 | #[test] |
| 255 | fn array_get_out_of_bounds() -> Result<()> { |
| 256 | let mut store = gc_store()?; |
| 257 | |
| 258 | let array_ty = ArrayType::new( |
| 259 | store.engine(), |
| 260 | FieldType::new(Mutability::Const, ValType::I32.into()), |
| 261 | ); |
| 262 | let pre = ArrayRefPre::new(&mut store, array_ty); |
| 263 | |
| 264 | let array = ArrayRef::new_fixed( |
| 265 | &mut store, |
| 266 | &pre, |
| 267 | &[Val::I32(11), Val::I32(22), Val::I32(33)], |
| 268 | )?; |
| 269 | |
| 270 | assert!(array.get(&mut store, 3).is_err()); |
| 271 | assert!(array.get(&mut store, 4).is_err()); |
| 272 | |
| 273 | Ok(()) |
| 274 | } |
| 275 | |
| 276 | #[test] |
| 277 | fn array_get_on_unrooted() -> Result<()> { |