MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / receive_null_funcref_from_wasm

Function receive_null_funcref_from_wasm

tests/all/funcref.rs:82–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80#[test]
81#[cfg_attr(miri, ignore)]
82fn receive_null_funcref_from_wasm() -> wasmtime::Result<()> {
83 let (mut store, module) = ref_types_module(
84 false,
85 r#"
86 (module
87 (func (export "get-null") (result funcref)
88 ref.null func
89 )
90 )
91 "#,
92 )?;
93
94 let instance = Instance::new(&mut store, &module, &[])?;
95 let get_null = instance.get_func(&mut store, "get-null").unwrap();
96
97 let mut results = [Val::I32(0)];
98 get_null.call(&mut store, &[], &mut results)?;
99 let result_func = results[0].unwrap_funcref();
100 assert!(result_func.is_none());
101
102 Ok(())
103}
104
105#[test]
106fn wrong_store() -> wasmtime::Result<()> {

Callers

nothing calls this directly

Calls 7

ref_types_moduleFunction · 0.85
OkFunction · 0.85
unwrap_funcrefMethod · 0.80
newFunction · 0.50
unwrapMethod · 0.45
get_funcMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected