| 2533 | |
| 2534 | #[test] |
| 2535 | fn anyref_ty_struct() -> Result<()> { |
| 2536 | let mut store = gc_store()?; |
| 2537 | let struct_ty = StructType::new( |
| 2538 | store.engine(), |
| 2539 | [FieldType::new(Mutability::Const, ValType::I32.into())], |
| 2540 | )?; |
| 2541 | let pre = StructRefPre::new(&mut store, struct_ty); |
| 2542 | let s = StructRef::new(&mut store, &pre, &[Val::I32(0)])?; |
| 2543 | let any: Rooted<AnyRef> = s.into(); |
| 2544 | let ty = any.ty(&store)?; |
| 2545 | assert!(matches!(ty, HeapType::ConcreteStruct(_))); |
| 2546 | Ok(()) |
| 2547 | } |
| 2548 | |
| 2549 | #[test] |
| 2550 | fn anyref_ty_extern_converted() -> Result<()> { |