| 275 | |
| 276 | #[test] |
| 277 | fn array_get_on_unrooted() -> Result<()> { |
| 278 | let mut store = gc_store()?; |
| 279 | |
| 280 | let array_ty = ArrayType::new( |
| 281 | store.engine(), |
| 282 | FieldType::new(Mutability::Const, ValType::I32.into()), |
| 283 | ); |
| 284 | let pre = ArrayRefPre::new(&mut store, array_ty); |
| 285 | |
| 286 | let array = { |
| 287 | let mut scope = RootScope::new(&mut store); |
| 288 | ArrayRef::new_fixed(&mut scope, &pre, &[Val::I32(11)])? |
| 289 | }; |
| 290 | |
| 291 | assert!(array.get(&mut store, 0).is_err()); |
| 292 | Ok(()) |
| 293 | } |
| 294 | |
| 295 | #[test] |
| 296 | #[should_panic = "wrong store"] |