diff --git a/test/example_wasm_files/globals.wat b/test/example_wasm_files/globals.wat index 94c191b1..efefaade 100644 --- a/test/example_wasm_files/globals.wat +++ b/test/example_wasm_files/globals.wat @@ -2,6 +2,8 @@ (global $meaning_of_life (export "meaning_of_life") i32 (i32.const 42)) (global (export "count_32") (mut i32) (i32.const -32)) (global (export "count_64") (mut i64) (i64.const -64)) + (global (export "externref") externref (ref.null extern)) + (global (export "funcref") funcref (ref.null func)) (global (export "bad_pi_32") (mut f32) (f32.const 0)) (global (export "bad_pi_64") (mut f64) (f64.const 0)) ) \ No newline at end of file diff --git a/test/wasmex/instance_test.exs b/test/wasmex/instance_test.exs index 068007e0..e74d5e1f 100644 --- a/test/wasmex/instance_test.exs +++ b/test/wasmex/instance_test.exs @@ -215,6 +215,12 @@ defmodule Wasmex.InstanceTest do assert {:ok, 42} = Wasmex.Instance.get_global_value(store, instance, "meaning_of_life") assert {:ok, -32} = Wasmex.Instance.get_global_value(store, instance, "count_32") assert {:ok, -64} = Wasmex.Instance.get_global_value(store, instance, "count_64") + + assert {:error, "unable_to_return_extern_ref_type"} = + Wasmex.Instance.get_global_value(store, instance, "externref") + + assert {:error, "unable_to_return_func_ref_type"} = + Wasmex.Instance.get_global_value(store, instance, "funcref") end test t(&Wasmex.Instance.set_global_value/4), context do